Thank you for your reply Emmanuel.
I'm glad to hear you think this should work, at least my data model is sound.
It looks like the only issue I have is that when updating the Container, the relationship between the Container and the Part subclasses is not stored. The Parts themselves are persisted correctly. If I hand edit the relationship, I can run tests successfully to retrieve a Container with all its parts.
Clearly the update of the Container is cascading correctly to save the Part, but it is not executing any SQL to update the Container row itself.
Here's the log:
2004-03-17 11:41:57,485 [main] DEBUG HibernateContainerDAO - addPartA - starting
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.impl.SessionImpl - updating [Container#1]
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.engine.Cascades - processing cascades for: Container
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.engine.Cascades - cascading to saveOrUpdate()
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.impl.SessionImpl - saveOrUpdate() unsaved instance
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.impl.SessionImpl - saving [PartA#<null>]
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.engine.Cascades - processing cascades for: PartA
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.engine.Cascades - done processing cascades for: PartA
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.persister.EntityPersister - Inserting entity: PartA (native id)
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.SQL - insert into PART (NAME, class) values (?, 'PartA')
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
2004-03-17 11:41:57,485 [main] DEBUG net.sf.hibernate.persister.EntityPersister - Dehydrating entity: [PartA#<null>]
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.type.StringType - binding 'Test PartA' to parameter: 1
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - closing statement
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.SQL - SELECT LAST_INSERT_ID()
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.persister.EntityPersister - Natively generated identity: 1
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - closing statement
2004-03-17 11:41:57,495 [Finalizer] DEBUG net.sf.hibernate.impl.SessionImpl - running Session.finalize()
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.engine.Cascades - processing cascades for: PartA
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.engine.Cascades - done processing cascades for: PartA
2004-03-17 11:41:57,495 [main] DEBUG net.sf.hibernate.engine.Cascades - done processing cascades for: Container
2004-03-17 11:41:57,495 [main] DEBUG HibernateContainerDAO - addPart - finished
Please let me know if I can provide any more information.
Thanks again. - Andre'
|