Hi,
We recently upgraded one of our applications from Hibernate 3.5 (milestone 1 to be precise ) to 4.1.4 and have noticed several strange issues and I'm wondering if its a behavioral change in Hibernate, or a configuration error on our part.
First up - we're still usig SessionFactory/Sessions rather than JPA/EntityManager.
The first strange thing we've noticed is that atho FlushMode is set to AUTO, it appears we have to manually call session.flush() in order for any changes to actually be saved. When debugging, I can see EntityInsertActions being recorded in the "insertions" field of the ActionQueue, only none of these appear to ever get inserted into the database, I had a thought this may be related to HHH-5472 [1] but none of the EntityInsertActions appear in the unresolved collection.
The second strange thing we're seeing also seems related to unresolved actions, in that we now seem to have to save each and every new Entity we're creating individually, rather than having hibernate cascade the inserts. For example, we have an Agreement entity, which contains a list of AgreementRoles, which in turn contains a PartyRole - all three objects in that tree are created, and we session.save(agreement).
Previously, Hibernate would insert the PartyRole and get an id, then insert the Agreement and get its id, then insert the AgreementRoles with each id ( at least, I assume thats the order it was doing it - I don't see any other way it could ).
Yet now it seems I have to manually save all three, in the correct order - which sounds more "correct", but also seems more.... cumbersome.
Has anyone seem any similar behaviour, or have any pointers to what I should look at for configuring things properly if it sounds like a config problem?
Thanks in advance,
Mar
[1]
https://hibernate.onjira.com/browse/HHH-5472