Please, I have 3 classes of objects.
They are parents from another. Example:
"A" is a conteiner of "B", and "B" set "C", like this:
Code:
A.add(B);
B.set(C);
So, I'm trying to save "A" Object, but Hibernate tell me this is not possible, because there are two or more "C" object with the same identifier.
The exception mesage is:
Code:
Caused by: com.expert.dao.ExpertDaoException: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.expert.pojos.Conta#25]
Where "com.expert.pojos.Conta" above is my "C" object.
I want add "A" object iside only 1 transaction. I think it will be very inconvenience if I have to do a new transaction to each "B" object I want to save in my data base.
Is there a more easy way to save "A" object in an only and unique session opened???
Thank you.
Cristiano