openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pinaki Poddar" <>
Subject RE: OneToOne Broken
Date Sun, 10 Dec 2006 20:27:13 GMT
> I agree, but wanted the smallest test code possible :)
The classes that access public persistent fields are persistence-aware
(they themselves may or may not be persitence-capable). The test classes
are persistence-aware in this case. Persistence-aware classes need to be
enhanced also.  

Pinaki Poddar
BEA Systems

-----Original Message-----
From: Dain Sundstrom [] 
Sent: Sunday, December 10, 2006 8:38 AM
Subject: Re: OneToOne Broken

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

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

Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

View raw message