Hi,
I am currently evaluating DB-VA and have some problems when generating code & database from UML.
Whenever I use the One-to-One / Many-to-Many / One-to-Many Associations in UML, I can generate the code just fine. But when I try insert data into the database (either from my own class or using the sample), I get the following exception:
17:56:11,515 ERROR AssertionFailure:22 - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: null id in persisttest.Publication entry (don't flush the Session after an exception occurs)
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:48)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:150)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:106)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1011)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.orm.PersistentTransaction.commit(PersistentTransaction.java:34)
at ormsamples.CreateTestData.createTestData(CreateTestData.java:18)
at ormsamples.CreateTestData.main(CreateTestData.java:30)
It seems that the primary key is not set at all. For some reason I always get this error when I try to associate two classes. What am I doing wrong? Am I missing something obvious?
I have attached the project file and the mapping for one of the two classes I try to associate.
Thanks for the help,
Michael
Test.vpp
Publication.hbm.xml