You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by koenr <ko...@teutenhof.be> on 2011/09/11 08:49:22 UTC

Unidirectional OneToMany without join table

According to 
http://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Undirectional_OneToMany.2C_No_Inverse_ManyToOne.2C_No_Join_Table_.28JPA_2.0.29
this article  JPA 2.0 supports Unidirectional OneToMany relationships,
without having to use a join table.

However, if I try to model this with OpenJPA 2.1.1, using the <join-column>
tag, I receive an error "You have supplied columns for
my.package.MyEntity.myList, but this mapping cannot have columns in this
context."

Does OpenJPA 2.1.1 support Unidirectional OneToMany relationships without a
join table? If not, will this be part of OpenJPA 2.2?

P.S. If I look at the "JSR-317 Persistence 2.0 Final Spec", it only seems to
specify Unidirectional OneToMany relationships with join tables.



--
View this message in context: http://openjpa.208410.n2.nabble.com/Unidirectional-OneToMany-without-join-table-tp6780201p6780201.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Unidirectional OneToMany without join table

Posted by Michael Dick <mi...@gmail.com>.
What version do you have in your persistence.xml file?

If the xml header indicates version 1.0 you'll get OpenJPA's old behavior
(and the error message you're seeing). If you have 2.0 in the xml header the
JoinColumn annotation should work.

-mike

On Sun, Sep 11, 2011 at 1:49 AM, koenr <ko...@teutenhof.be> wrote:

> According to
>
> http://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Undirectional_OneToMany.2C_No_Inverse_ManyToOne.2C_No_Join_Table_.28JPA_2.0.29
> this article  JPA 2.0 supports Unidirectional OneToMany relationships,
> without having to use a join table.
>
> However, if I try to model this with OpenJPA 2.1.1, using the <join-column>
> tag, I receive an error "You have supplied columns for
> my.package.MyEntity.myList, but this mapping cannot have columns in this
> context."
>
> Does OpenJPA 2.1.1 support Unidirectional OneToMany relationships without a
> join table? If not, will this be part of OpenJPA 2.2?
>
> P.S. If I look at the "JSR-317 Persistence 2.0 Final Spec", it only seems
> to
> specify Unidirectional OneToMany relationships with join tables.
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Unidirectional-OneToMany-without-join-table-tp6780201p6780201.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>