merge « EntityManager « JPA Q&A





1. JPA EntityManager: Why use persist() over merge()?    stackoverflow.com

EntityManager.merge() can insert new objects and update existing ones. Why would one want to use persist() (which can only create new objects)?

2. Does EntityManager.merge really merge?    forum.hibernate.org

Is there really no one who can answer my question? I find this a bit hard to believe. Surely the devs who wrote the implementation would know. Maybe my question is too confusing. Ok i'll try again. How can I get the EntityManager.merge() function to produce true merge SQL statements where only the field values that have actually been modified are ...

3. EntityManager.merge() not fast enough    forum.hibernate.org

Hello all, I'm trying to update an object "a" of type "A" in a database (PostgresSQL) via the EntityManager.merge() method but it seems like the data are not edited in the base soon enough. Let's say "a" has a field name set to null and I wanna edit it. The scenario is as follows : 1 a user requests an EJB ...

4. intercept EntityManager persist/merge/remove    forum.hibernate.org

6. A little bit EntityManager merge semantics!    forum.hibernate.org

7. [JPA] CollectionOfElements and EntityManager.merge - BUG?    forum.hibernate.org

I have a user class with this property @CollectionOfElements(fetch = FetchType.EAGER) private Set buddies; I've chosen to use CollectionOfElements to avoid detachment problems and lazy initialization exception: this is a client server application where I have to continously exchange data and it was simpler to 'cut' the model a bit in order not to have too big graphs of object when ...

8. EntityManager.merge bugged in hibernate??    forum.hibernate.org

I found a very strange behaviour using Hibernate as JPA implementation. I don't know, but it looks like a bug. Code: @Entity public class User { @Id @GeneratedValue private Long id; @Column(unique = true) private String name; @Column private String ...