Error during cascaded merge

#1

Hello!

I have a new problem with ObjectDB 2.5.5_02. This issue appeared after the upgrade from 2.5.5.

I get the following exception:

Caused by: com.objectdb.o._IllegalArgumentException: Specified object is not an entity object
at com.objectdb.o._IllegalArgumentException.b(_IllegalArgumentException.java:43)
at com.objectdb.o.JPE.g(JPE.java:107)
at com.objectdb.o.ERR.f(ERR.java:56)
at com.objectdb.o.OBC.onObjectDBError(OBC.java:1506)
at com.objectdb.jpa.EMImpl.merge(EMImpl.java:518)

To narrow the problem down I created this simple testcase which triggers the error:

@Test
@Transactional
public void testChannelConfigDirect() {
    Query query = em.createQuery("SELECT u FROM Unit u");
    List<Unit> result = query.getResultList();
    Unit unit = result.get(0);
    em.detach(unit);
    unit.getChannelConfigurationSets().add(new ChannelConfigurationSet());
    em.merge(unit);
}

This is exactly what happens in our webapp. A unit entity gets detached, the user edits it, its merged back.
Here are the relevant parts of the involved Entity classes:

@Entity
@Indices({
    @Index(members = {"lastPosition.receiveTime"}),
    @Index(members = {"lastMovingPosition.receiveTime"}),})
public class Unit implements Serializable, Comparable<Unit> {
...

@OneToMany(mappedBy = "unit", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
    @OrderBy("configDate DESC")
    public List<ChannelConfigurationSet> getChannelConfigurationSets() {
        return channelConfigurationSets;
    }
...
}
@Entity
@Index(members = {"unit", "configDate"}, unique = "true")
public class ChannelConfigurationSet implements Serializable {
...
}

As I said before it all worked before the update to _02.

Regards
Ralph

#2

Merge errors are the result of fixing issue #222, which indicates correctly that an attempt to pass a non entity object to merge should throw an exception with a clear error message.

Unfortunately the fix in build 2.5.5_02 is broken. Please try build 2.5.5_03.

ObjectDB Support
#3

Thanks!

The new build works perfectly.

Reply