Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] [MOXy] setting bi-directional references during unmarshalling

Hi Polly,

Would it be possible for you to send a usecase/example of using a Many-To-Many bidirectional relationship with a composite mapping? I'm not sure how an object that is the target of a composite mapping could ever have more than one owning object in an XML document.

I may be missing something obvious, but if you have a usecase for this, it's something that we could potentially support.

Thanks,

-Matt

polly.c.chang wrote:
Hi Matt,

We use Composite mappings on many-to-many bidirectional associations also. 
We do not use the Reference mappings at all.  Would it be possible to have a
future version of Eclipse 1.2 or 2.0 to support setting the back-reference
on many-to-many Composite mappings?

Thanks for testing and letting me know that EclipseLink can use private
accessors for OXM!  

Thanks,
Polly

Matt MacIvor wrote:
  
Hi Polly, 

The current support in EclipseLink 1.2 wouldn't handle the case of a
many-to-many backpointer. EclipseLink 1.2 only handles backpointers on
composite mappings, and since composite mappings are privately-owned,
the many to many case isn't handled here. The updated support going
into EclipseLink 2.0 includes support for Reference mappings which
allows for the many-to-many case. This support will be available in the
nightly EclipseLink 2.0 builds this week if you'd like to try it out.
I'll let you know once the code is available. 

Using method access on your mapping to set the backpointer yourself as
you described would be a good workaround. I did a quick test and found
that private and protected getters/setters will work for method access
if you don't want to make the methods public. 

    
  

Back to the top