Interesting. I bet that the problem is that you directly set the public
field in your test code, but you didn't run the OpenJPA bytecode
processor over the test code, so OpenJPA didn't intercept the field set.

If you want this type of use case, OpenJPA needs to know about (and
process) the classes that directly access persistent fields, so that it
can eagerly track changes.

How are you deploying? It might make sense to change our
ClassTransformer impl to automatically process all classes in a deployed
Java EE archive by default rather than just the ones marked @Entity and
@MappedSuperclass. For people who are relying on automatic enhancement,
this certainly is a surprising situation to end up in.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
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. 

> -----Original Message-----
> From: Dain Sundstrom [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, December 10, 2006 8:38 AM
> To: open-jpa-dev@incubator.apache.org
> 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 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
> 

Reply via email to