Dear Hibernate community members,
I am new to the hibernate community and I have an important question. I want to update a persistent object with a transient object.
I have saved in a DB with hyperjaxb and hibernate from Xml file an object A1 with its attributs a1, a2; other attributes a3, a4 and link to object B1 are not filled.
Now I have in my DB an persistent object A1.
Then I have loaded a new Xml file descriping the update of A1, a1, a3, a4 and the link to an object B. With jaxb, I get a new transient object A2 .
If I store it directly in the DB with Hibernate it creates me a new object A2 with a new id. How can I say to hibernate that it have to be compared with the previous object A1 ( for example thy share the same attribute a1. I want Hibernate make a automatic merge / fusion between my two objects for each attributs and foreach relation/association ?
At this end, I want to have:
- A1: a1, a2, a3, a4 link to B
- B : link to A1
and not:
-A1: a1, a2
-A2: a1, a3, a4 link to B
-B: link to A2
After solving this problem, is there a way to automaticaly update a persistent graph objects with a transient graph objects?
If I was not cleared, tell me , I am french.
Thanks you for your help.
Francois, from France
|