Joined: Tue Oct 06, 2009 2:03 pm Posts: 7
|
I have an enity entityA which I extract from the database using a finder. I update enityA then put it back in the database calling entityA.merge() instead of entity.persist()
Is this correct so far. If so at least I am on the right tack on how to update a persisted enity.
But enityA also has a relationship with another enity enityB
entityA has many to one relationship with entityB
When enityA is updated or created enityB is as well.
in my enityA I have the following annotations
@ManyToOne (cascade = {CascadeType.PERSIST,CascadeType.MERGE}) @JoinColumn(name = "entity_b_id") private EntityB entityB;
But when I run entityA.merge() I get two entityAs the old one an the updated enityA as a new row.
Cheers for any help
|
|