Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Cascading object occasionally dont update/merge, but throw exception. Eclipselink or my bug?

Could you please include the exception and full stack trace.


Raven McSmith wrote:
> 
> 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 bList = new ArrayList();
> ....
> }
> 
> 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
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/Cascading-object-occasionally-dont-update-merge%2C-but-throw-exception.-Eclipselink-or-my-bug--tp28337797p28378214.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top