arijitm wrote:
arijitm wrote:
...It asks me to save the person object first. Can I get the same effect as the first one I described (automatic save) in this case also? And 2ndly, is there any way to get this effect with the ID field defined as ASSIGNED?
Regards
Arijit
As an addendum to the previous topic: supposing I have a one-to-many relationship between a person and a labbook. If I delete one person object, would the associated labbook objects be deleted as well? It isn't working that way in practice though.....
Arijit
No, things have all messed up. Using the same mapping files described above (changed only the id part of the labBook object to assigned, as that is what I need), I can't get the child object (a labBook) saved when the parent (a person) is saved. I am getting the following error:
[java] Assgined LSID: urn:lsid:mygrid.org.uk:labbookview:5f3768eb80f094ea00e3849c4f914edb
[java] - Could not synchronize database state with session
[java] net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row not found)
[java] net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row not found)
[java] at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:25)
[java] at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:25)
[java] at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:688)
[java] at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:688)
[java] at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:641)
[java] at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:641)
[java] at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
[java] at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
[java] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)
[java] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)
[java] at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2336)
[java] at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2336)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
[java] at uk.org.mygrid.mir.test.HibernateTest.createTestData(HibernateTest.java:142)
[java] at uk.org.mygrid.mir.test.HibernateTest.main(HibernateTest.java:249)
[java] at uk.org.mygrid.mir.test.HibernateTest.createTestData(HibernateTest.java:142)
[java] java.lang.RuntimeException: couldn't get connection
[java] at uk.org.mygrid.mir.test.HibernateTest.main(HibernateTest.java:249)
[java] at uk.org.mygrid.mir.test.HibernateTest.main(HibernateTest.java:255)
[java] Exception in thread "main"
Please give me some hints. I got to get past this issue.
Arijit