[ https://issues.apache.org/jira/browse/OPENJPA-2239?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vermeulen updated OPENJPA-2239: ------------------------------- Attachment: OrderLineRemovalBugTest.java OrderLine.java Order.java Entities and test case which show the bug. > removing from one List<X> removes all from other List<X> in same entity > ----------------------------------------------------------------------- > > Key: OPENJPA-2239 > URL: https://issues.apache.org/jira/browse/OPENJPA-2239 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 2.1.1 > Reporter: Vermeulen > Attachments: Order.java, OrderLine.java, OrderLineRemovalBugTest.java > > > I have an Order entity that has two separate lists of OrderLine entities: > ... > @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) > private List<OrderLine> plannedOrderLines = new ArrayList<OrderLine>(); > @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) > private List<OrderLine> actualOrderLines = new ArrayList<OrderLine>(); > ... > I remove a single element from actualOrderLines, then merge the entity and > close the entity manager. When I find the entity again with a different > entity manager, the plannedOrderLines list is empty. > OpenJPA generates one join table that contains entries for both lists. I used > this configuration for a long time and it seems to work fine except for this > bug. I verified in the database that the entries for planned order lines are > all removed from the join table. > Workaround: use @JoinTable or @JoinColumn annotation so that both lists do > not map to the same join table. -- 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