Hi!
I'm confused and I think I'm missing some concept.
The sort version: The entity is persisted twice if I call childEntityDAO.makePersistent(e).
The long version: I have 2 entities, Company and Division.
The DAO layers is implemented as described in the section 16.4.2 of
Java Persistence with Hibernate. If I try to save a Division like the follow listing it works fine:
But if I call the divisionDAO.makePersistent(d) I got 2 identical (apart form the ID column) rows on my database. I need to call the makePersistent method because I need to get the ID of the persisted entity to use on my tests.
I found out that there is a bug (
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3810) that affects the version of the hibernate I was using.
I updated to the 3.3.2 but it didn't stop the entity to be persisted twice.
As far as I understood from the book if I call the
d = divisionDAO.makePersistent(d) should be ignored. There must be something wrong with my mapping then.
Any ideas appreciated,
Luiz Filipe