openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laird Nelson <ljnel...@gmail.com>
Subject Re: Cascading problem...bug?
Date Sun, 04 Oct 2009 13:46:32 GMT
I have altered the Maven project locally to use Hibernate instead and it
runs the test case with no problems in exactly the way that I would expect.
I'll try it with EclipseLink next.  If that succeeds as well, I'll file a
bug.

Best,
Laird

On Sat, Oct 3, 2009 at 1:03 PM, Laird Nelson <ljnelson@gmail.com> wrote:

> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message