Hi team,
merging/rebasing the migration PR, I am getting one test failure, with a
weird "SQLGrammarException: could not prepare statement" error, when
merging the categories:
-------------------------------------------------------------------------------
Test set: org.jboss.aerogear.unifiedpush.jpa.InstallationDaoTest
-------------------------------------------------------------------------------
Tests run: 34, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.519
sec <<< FAILURE!
mergeCategories(org.jboss.aerogear.unifiedpush.jpa.InstallationDaoTest)
Time elapsed: 0.041 sec <<< ERROR!
javax.persistence.PersistenceException:
org.hibernate.exception.SQLGrammarException: could not prepare
statement
at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
at org.apache.derby.impl.sql.compile.NextSequenceNode.bindExpression(Unknown
Source)
at org.apache.derby.impl.sql.compile.ValueNode.bindExpression(Unknown
Source)
at org.apache.derby.impl.sql.compile.ResultColumn.bindExpression(Unknown
Source)
at org.apache.derby.impl.sql.compile.ResultColumnList.bindExpressions(Unknown
Source)
at org.apache.derby.impl.sql.compile.RowResultSetNode.bindExpressions(Unknown
Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(Unknown
Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown
Source)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown
Source)
at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown
Source)
at
org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:96)
at
org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:183)
at
org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:83)
at org.hibernate.id.SequenceGenerator.generateHolder(SequenceGenerator.java:120)
at
org.hibernate.id.SequenceHiLoGenerator$1.getNextValue(SequenceHiLoGenerator.java:81)
at
org.hibernate.id.enhanced.OptimizerFactory$LegacyHiLoAlgorithmOptimizer.generate(OptimizerFactory.java:399)
at org.hibernate.id.SequenceHiLoGenerator.generate(SequenceHiLoGenerator.java:78)
at
org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:117)
at
org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78)
at
org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208)
at
org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:762)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:755)
at
org.hibernate.ejb.engine.spi.EJB3CascadingAction$1.cascade(EJB3CascadingAction.java:53)
at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:396)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:339)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:207)
at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:426)
at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:366)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:342)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:207)
at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:164)
at
org.hibernate.event.internal.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:449)
at
org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:292)
at
org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:192)
at
org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:135)
at
org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78)
at
org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208)
at
org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151)
at
org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:78)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:772)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:746)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:750)
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:875)
at sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at
org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:44)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
at
org.jboss.weld.proxies.EntityManager$1406262522$Proxy$_$$_WeldClientProxy.persist(EntityManager$1406262522$Proxy$_$$_WeldClientProxy.java)
at org.jboss.aerogear.unifiedpush.jpa.dao.impl.JPABaseDao.create(JPABaseDao.java:55)
at
org.jboss.aerogear.unifiedpush.jpa.InstallationDaoTest.mergeCategories(InstallationDaoTest.java:234)
Looks like the error is due to the sequence table, added to ORM:
https://github.com/aerogear/aerogear-unifiedpush-server/commit/d9a7ab913d...
Now, the sequence table is part of the DDL script:
https://github.com/matzew/aerogear-unifiedpush-server/blob/Migration_merg...
But it's missing the dataset XML files for DBunit, however Erik Jan tried
adding it here:
https://github.com/edewit/aerogear-unifiedpush-server/commit/93a6a9af0b00...
But that also does not help ;-(
However, Gunnar (from Hibernate team) thinks the problem is that this ddl
creates sequence as table, where SequenceGenerator is expecting an actual
sequence
I think I am a bit over asked here, from both DBUnit and the migration
aspects. Therefore any feedback on these issues is more than welcome :-)
Thanks a lot!
-Matthias
--
Matthias Wessendorf
blog:
http://matthiaswessendorf.wordpress.com/
sessions:
http://www.slideshare.net/mwessendorf
twitter:
http://twitter.com/mwessendorf