Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Question with ManyToMany relation

This seems a little odd, if B's primary key is both 1B ad 2B, then how can
the join table only have 1B?  Is 1B unique, if so then why do you require 2B
in the primary key?

In general EclipseLink does support using alternate keys in a m-m, but JPA
does not.  You can edit/define the ManyToManyMapping using a
DescriptorCustomizer and the code API.  Just add only the 1B field, however
if 1B is not unique, I'm not sure how you intend this to function.



john arevalo wrote:
> 
> Hi list,
> 
> I have 2 Entities (Mapped from AS400)
> 
> TableA:
> field1A
> field2A
> field3A
> primary key(field1A,field2A,field3A)  --- TableAPK @EmbeddedId
> 
> TableB:
> field1B
> field2B
> primary key(field1B,field2B)  --- TableBPK @EmbeddedId
> 
> next entity is relationship ManyToMany between TableA  and TableB
> 
> TableAB
> field1B
> field1A
> field2A
> field3A
> primary key(field1B,field1A,field2A,field3A)
> 
> How can i create EntityAB? 3rd table only have field1B as related
> field with TableB.
> 
> Thanks for your replies.
> 
> Regards,
> -- 
> John Arévalo
> GNU/Linux User #443701
> http://counter.li.org/
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Question-with-ManyToMany-relation-tp19862493p19879353.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top