MERGE « Eclipse « JPA Q&A

1. programatically make all relationships CascadeType.MERGE

We have strictly defined which relationships are CascadeType.MERGE in our app. This plays into our version checking (optimistic locking). So, our CascadeType definitions sometimes have MERGE and sometimes not. ...

2. A Flush() problem after Merging an Entity

My problem is that I have an object A which contains a list of B Objects

class A {

   List<B> list;

When I make a "merge" of an ...

3. Why does JPA do a double insert upon merge()

In EclipseLink, I run into a problem where an element is inserted twice, resulting into a primary key violation. The scenario is as follows: I have three entities, Element, Restriction and RestrictionElement. ...

4. Why am I getting "Duplicate entry" errors for related objects upon merge in eclipselink?

I have an entity class that contains a map of key-value pairs which live in a different table and there may be no such pairs for a given entity. The relevant ...

5. Merging JPA entity returns old values

I have 2 JPA entities that have a bidirectional relationship between them.

public class A {

     @ManyToOne(cascade={CascadeType.PERSIST, CascadeType.MERGE})
     B b;


6. JPA Hibernate vs EclipseLink: Merge() differs for lazy rel

Hi, we experience a huge difference in behaviour between Hibernate JPA 3.2.5 and EclipseLink 1.2.2 when merging objects with "lazy" relations. Suppose you have a Master class with one-to-many relation to Detail like Code: @Entity public class Master implements Serializable { @Id private Long id; @OneToMany(mappedBy = "master", cascade={CascadeType.MERGE, ...