tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Cascading problem...bug?
Date Fri, 09 Oct 2009 05:10:25 GMT
Nothing sticks out at me.  Hopefully the OpenJPA guys find time to  
check it out.

One thing I'd try in the "it can't hurt" category is to try listing  
your entities explicitly via the <class> element in the  
persistence.xml to guarantee they get enhanced (assuming you've setup  
the javaagent).

No idea if that's it, but can't hurt.

-David


On Oct 3, 2009, at 10:11 AM, Laird Nelson wrote:

> FWIW, in order to make progress on my JPA mapping question--which  
> really has
> nothing to do with OpenEJB--I forwarded the following message (and  
> attached
> maven project demonstrating the root problem--see the Nabble  
> download URL
> towards the bottom) to the OpenJPA users list.  I'm CC:ing it to  
> this list
> because I find that the two groups of users overlap significantly.
>
> To run the test case project, unjar the .jar file and run mvn test.   
> Any
> input (including "You're stupid!  Why didn't you do ABC/XYZ?!") is  
> heartly
> welcomed as I cannot figure out how to make progress.
>
> I should finally note that the DDL generated by OpenJPA is exactly  
> what I
> want, in case that makes it easier to visualize.
>
> Thanks,
> Laird
>
> ---------- Forwarded message ----------
> From: ljnelson (via Nabble)
> <ml-user+210534-64246958@n2.nabble.com<ml-user%2B210534-64246958@n2.nabble.com

> >
>>
> Date: Sat, Oct 3, 2009 at 1:03 PM
> Subject: Cascading problem...bug?
> To: ljnelson <ljnelson@gmail.com>
>
>
> I've attached a simple maven project that demonstrates what might be  
> a bug
> in the way that OpenJPA handles cascading.  However I freely admit  
> of the
> strong possibility that instead I'm just being stupid.  That's why I'm
> coming to the user list first.
>
> Please find attached a JPA project that describes the following:
>
> X has zero to many XYs indexed by their type and an autogenerated  
> ID.  X's
> @OneToMany relationship with XY is marked as CascadeType.ALL.
>
> Y has exactly one X and an autogenerated ID.  Y's @ManyToOne  
> relationship
> with X is marked as CascadeType.ALL.
>
> XY has exactly one X
> XY has exactly one Y
> XY has a type attribute
> XY is uniquely identified logically by its X and type
>
> In the project, I do this:
> X x = new X();
> Y y = new Y(x);
> x.put("TestType", y); // causes new XY to be put in the JPA  
> @OneToMany Map
> association
> this.em.persist(x);
>
> It fails, telling me that it has encountered an unpersisted object  
> in the XY
> map.  It suggests as a solution that I should mark the XY map as being
> CascadeType.PERSIST, which I have (?!).
>
> I've modified the test case to make things very explicit as well; I  
> have
> inserted persist() and flush() calls liberally throughout to no  
> effect.
>
> Thanks for your time.  Unjar the attached Jar file to see the maven  
> project;
> run with mvn test.
>
> Best,
> Laird
>
>
> *bug.jar* (8K) Download
> Attachment<http://n2.nabble.com/attachment/3760924/0/bug.jar>
>
>
> ------------------------------
> View message @
> http://n2.nabble.com/Cascading-problem-bug-tp3760924p3760924.html
> To start a new topic under OpenJPA Users, email
> ml-node+208411-553807638@n2.nabble.com<ml-node%2B208411-553807638@n2.nabble.com 
> >
> To unsubscribe from OpenJPA Users, click
> here<http://n2.nabble.com/subscriptions/Unsubscribe.jtp?code=bGpuZWxzb25AZ21haWwuY29tfDIwODQxMXw4MzU2MDY3MDA=

> >.


Mime
View raw message