openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <d...@iq80.com>
Subject Re: OneToOne Broken
Date Sun, 10 Dec 2006 16:37:53 GMT
On Dec 9, 2006, at 9:01 PM, Craig L Russell wrote:

> Hi Dain,
>
> You don't have a relationship from Article to Magazine, so it's a  
> unidirectional mapping.

Are you sure?  If you uncomment the line that is commented out in  
testResourceLocal it works.  I assume that means that I do have a  
relationship since OpenJPA is correctly filling in the fk column.

> Add a Magazine mag; field in Article and see if it starts working.

That is the way I originally had the test code, but I wanted to  
create the smallest test code possible, so I remove it.

Anyway, I just added a "public Magazine magazine" field to the  
Article class and added this to the test-mappings.xml file:

   <one-to-one name="magazine" mapped-by="coverArticle"/>

...and it still fails.

> You will also need to identify the "owner" of the relationship in  
> order to make it work at all.

I thought when I declare the "join-column" in the  
Magazine.coverArticle field, that made it the owner.  How do I  
declare the owner of the relationship?

> Just a note, JPA does not do well with unidirectional  
> relationships. There is more unspecified than specified there.

OK. I'll avoid them

> And public fields are JPA for evil.

I agree, but wanted the smallest test code possible :)

> Craig

Thanks Craig,

-dain

Mime
View raw message