[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Dyn. Weaving, Lazy Collection, Clone Problem
|
Hi,
I have two entities as follows:
@Entity
public class Foo {
@Id
private Long id;
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private final Collection<Bar> bars = new ArrayList<Bar>();
}
@Entity
public class Bar {
@Transient
private transient final PropertyChangeSupport pcs = new
PropertyChangeSupport(this);
@Id
private Long id;
@Basic(fetch = FetchType.LAZY)
@Lob
private byte[] data;
}
When calling Foo.getBars() I receive an IndirectList. When accessing
elements of that list, the lazy object (here it's only 1 element) is
being loaded and instantiated. However I can see during debug that there
is some kind of "cloning" going on (registerExistingObject() is being
called). In detail the Bar instance is being "cloned" and afterwards
original and clone both point at the same PCS instance - PCS has a
back-reference to the original Bar instance. But when accessing the list
retrieved by getBars() I have access to the clone whose PCS is messed up.
Any ideas what is going wrong? When weaving is turned off everything
works fine.
I hope the problem is clear enough (it's 2 am over here).
Thanks in advance,
Oliver