openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MiƂosz Tylenda <mtyle...@o2.pl>
Subject Re: openjpa 1.2.2 - Optimistic Lock Exception
Date Sun, 04 Apr 2010 07:36:48 GMT
Hi Seth,

As for the infamous message, I think the JPA 1 spec (and thus OpenJPA 1.2.2) disallows the
@JoinColumn being placed along with @OneToMany. JPA 2 is more flexible here. There was a discussion
on this in the JIRA issue tracker [1].

Greetings,
Milosz

[1] http://issues.apache.org/jira/browse/OPENJPA-1253


> 
> Apparently the @JoinTable is creating SQL similar to the following:
> 
> SELECT t0.*
> FROM PROOF.ACCOUNTS t0,
> PROOF.ACTIVITY t1,
> PROOF.ACTIVITY t2
> WHERE t0.ACCOUNT_ID = t1.ACCOUNT_ID (+)
> AND t1.ACCOUNT_ID = t2.ACCOUNT_ID
> 
> Why openJPA is creating a join to the same table twice is beyond me. I
> believe this is why I'm getting the OptimisticLockException.
> 
> 
> So, I modified the annotations to the following:
> 
> @OneToMany(fetch=FetchType.EAGER,cascade=CascadeType.ALL,targetEntity=Activity.class)
> @JoinColumn(name="ACCOUNT_ID", referencedColumnName="ACCOUNT_ID")
> private Set<Activity> activities = new HashSet<Activity>();
> 
> Then I get the infamous: "You have supplied columns for ... but this mapping
> cannot have columns in this context."
> 
> I think my relationship annotations are inaccurate. Still getting burned
> here.
> 
> 
> -----
> Seth Jackson
> -- 
> View this message in context: http://n2.nabble.com/openjpa-1-2-2-Optimistic-Lock-Exception-tp4842528p4842849.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 

Mime
View raw message