openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bálint Balázs (Created) (JIRA) <j...@apache.org>
Subject [jira] [Created] (OPENJPA-2061) After EntityManager.flush() is called, no identifier will be generated for identifiers annotated with @GeneratedValue
Date Fri, 14 Oct 2011 10:00:12 GMT
After EntityManager.flush() is called, no identifier will be generated for identifiers annotated
with @GeneratedValue
---------------------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-2061
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2061
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
    Affects Versions: 2.1.1
         Environment: Derby database. The behaviour is the same with Oracle and MySQL, however.
It is also independent of the generation strategy
            Reporter: Bálint Balázs
         Attachments: Jpacase.java

    EntityTransaction transaction = em.getTransaction();
    transaction.begin();
    Query query = em.createQuery("select m from Master m");
    @SuppressWarnings("unchecked")
    List<Master> l = query.getResultList();

    for (Master m: l) {

      //-- Two additional Detail's are created for each Master.
      m.getDetails().add(createDetail());
      m.getDetails().add(createDetail());

      //-- The following flush() causes the trouble: The second detail is lost in the second
Master:
      //-- No id will be autogenerated for Detail instance after the flush()
      //-- If you omit this line, the test case works fine.
      em.flush();
    }

    transaction.commit();
    em.close();


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message