195 words

ObjectDB 2.6.9_06 (embedded): Cascading merge resulting in duplicate objects

#1
2016-12-14 18:59

This issue maybe related to issue #110 (http://www.objectdb.com/database/issue/110). Because that issue has been closed as "fixed", I am reporting this new issue.

This is my class definition:

@Entity
public abstract class Person {
 
    @OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
    private List<Address> addresses;
 
    public Person(){
        addresses = new ArrayList<Address>();
    }
}

Two non-abstract classes (LegalPerson and NaturalPerson) are derived from this class.

If I load a NaturalPerson entity from the database, then add a new address to the object's "addresses" list and use EntityManager.merge(object) to persist it along with the new address, the database contains two new entries in the Address extent, i.e. there is a duplicate entity that is not related to any other entity in the database. In explorer I can see that the "detached" entity is created first (ID #... is 2 less than that of the entity related to the person's address list).

If I use "EntityManager.persist(object)" instead, only one Address entity is created (as expected).

Am I doing something wrong or is this still a bug of version 2.6.9_06 (embedded)?

jtuemmer
jtuemmer's picture
Joined on 2016-12-13
User Post #1
#2
2016-12-15 10:31

As far as we can tell issue #110 is resolved. There could be another similar issue.

Please provide a minimal test case (see posting instructions) so we check your report.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,677

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel