You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Andras Szerdahelyi (Commented) (JIRA)" <ji...@apache.org> on 2011/10/11 12:51:11 UTC

[jira] [Commented] (OPENJPA-1253) JoinColumn annotation not allowed in conjunction with *ToMany annotation

    [ https://issues.apache.org/jira/browse/OPENJPA-1253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13124924#comment-13124924 ] 

Andras Szerdahelyi commented on OPENJPA-1253:
---------------------------------------------

for anyone who is google-ing this, i got the same exception despite being on the 2.0 spec, the problem was the entity referred in the relationship was not listed in persistence.xml..

<class>package.RelatedEntity</class>
                
> JoinColumn annotation not allowed in conjunction with *ToMany annotation
> ------------------------------------------------------------------------
>
>                 Key: OPENJPA-1253
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1253
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.0.0-M1, 2.0.0-M2, 2.0.0-M3
>            Reporter: Rick Curtis
>            Assignee: Fay Wang
>             Fix For: 2.0.0-M3
>
>
> I receive the following exception if I have an Entity with a One(Many)ToMany relationship with another Entity. 
> <openjpa-2.0.0-SNAPSHOT-r422266:805588 fatal user error> org.apache.openjpa.persistence.ArgumentException: You have supplied columns for "....Entity", but this mapping cannot have columns in this context.
> To recreate the failure, add a @JoinColumn annotation to one of the *ToMany relationships in org.apache.openjpa.persistence.jdbc.annotations.AnnoTest1. 
> example:
>     @MapKey(name = "basic")
>     @OneToMany(mappedBy = "oneManyOwner")
>     @JoinColumn(name = "asdf")
>     protected Map<String, AnnoTest2> inverseOwnerMapKey = new HashMap();
> Then run:
> trunk\openjpa-parent\openjpa-persistence-jdbc>mvn test -Dtest=org.apache.openjpa.persistence.jdbc.annotations.TestOneToMany

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira