"Failed to serialize instance" of Set problem

#1

Hi,

I'm trying to persists objects defined as follows:

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public abstract class AbstractContainer {
...

  @OneToMany(fetch = FetchType.LAZY, mappedBy="parent")
  private Set<AbstractContainer> abstractContainers = com.google.common.collect.Sets.newIdentityHashSet();
}

Got the following exception:

com.objectdb.o.UserException: Failed to serialize instance of com.google.common.collect.Sets$SetFromMap - field xxx.AbstractContainer.abstractContainers
at com.objectdb.o.MSG.d(MSG.java:74)
at com.objectdb.o.BYW.V(BYW.java:780)
at com.objectdb.o.TYW.aq(TYW.java:353)
at com.objectdb.o.TYW.writeElement(TYW.java:253)
at com.objectdb.o.UMR$R.A(UMR.java:976)
at com.objectdb.o.UMR.z(UMR.java:565)
at com.objectdb.o.UML.u(UML.java:537)
at com.objectdb.o.ENH.d(ENH.java:236)
at com.objectdb.o.ENT.Y(ENT.java:888)
at com.objectdb.o.STA.Z(STA.java:656)
at com.objectdb.o.STM.I(STM.java:536)
at com.objectdb.o.OBM.bJ(OBM.java:877)
at com.objectdb.o.OBM.bH(OBM.java:734)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:287)

What do I wrong?

Regards,

Vladimir

#2

Maybe the set contains objects that cannot be serialized.

Check the full stack trace, including nested exceptions, in the log file.

ObjectDB Support
#3

Hi support,

Yes, stack trace shows ObjectDB tries to serialize the collection using ordinary Java serialization ignoring the @OneToMany reference :-(

Regards,

Vladimir

#4

Build 2.4.7_06 should add support of Google collections. Please try it.

ObjectDB Support
#5

Looks like it works in 2.4.7_06

Regards,

Vladimir

Reply