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) <[email protected]<ml-user%[email protected]> > Date: Sat, Oct 3, 2009 at 1:03 PM Subject: Cascading problem...bug? To: ljnelson <[email protected]> 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 [email protected]<ml-node%[email protected]> To unsubscribe from OpenJPA Users, click here<http://n2.nabble.com/subscriptions/Unsubscribe.jtp?code=bGpuZWxzb25AZ21haWwuY29tfDIwODQxMXw4MzU2MDY3MDA=>.
