Id « EntityManager « JPA Q&A





1. Id not being set when calling EntityManager.merge()    stackoverflow.com

I have a simple OneToMany association between 2 object Parent & Child as shown below. Parent Entity

    @Entity
    public class Parent {
     ...

2. auto generated id and EntityManager.persist    forum.hibernate.org

3. Id not being set when calling EntityManager.merge()    forum.hibernate.org

Hi, I am having a problem that Hibernate is not assigning the generated id from the database to the instances that were created. The specific problem I am working on is one-to-many association, where the whole has a list of parts. Here are the entities used: Code: @Entity public class Whole { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) ...