ObjectDB ObjectDB

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

#1

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)?

edit
delete
#2

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
edit
delete

Reply

To post on this website please sign in.