[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Cascading object occasionally dont update/merge, but throw exception. Eclipselink or my bug?
|
Hi,
I am having the problem that my object from a cascaded class model
_sometimes_ don't update/merge but throw an exception.
This only happens after objects have been persisted and are now (to a
bigger extend) updated, changed, modified. Small modifications will
work fine.
I will give an descriptive example after the model.
My model looks almost like his:
class a
@Entity
public class A implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private int id;
private String name;
@OneToMany(cascade=CascadeType.ALL)
@PrivateOwned
private List<B> bList = new ArrayList<B>();
....
}
class b
@Entity
public class B implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private int id;
...
@OneToOne(cascade=CascadeType.ALL)
private A nextA;
....
}
My program code makes sure that there is never a cycle in the objects.
Meaning that no nextA will have an entry of object A where it is self
defined.
My problem is not adding objects but deleting/modifying them.
Example:
When I have several of these object persisted and I am now changing
one instance of A which had 4 entries in bList, and I am going to
clear bList and try to merge(), flush() the object, I will get an
exception, saying that there are duplicate entries for the key ID from
object A.
If I just remove one object from the list and the merge() or flush()
the object with Eclipselink the operation works fine.
Similarly I think is the situation when changing entries in bList.
This is really hard to debug, so I just can guess. If I change many
things (excluding adding), then sometimes the merge(), flush()
operation throws an exception, but it is just sometimes, so really
hard to debug.
Do you know any solution to this problem?
Is it my fault or did I find a bug in Eclipselink?
Thanks
Raven