Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Problems Mapping Map

Also you could create an association object to model the many-to-many join


Gordon Yorke-2 wrote:
> Ok, l thought you were attempting to map pre-existing  tables not 
> generate them.  What you are seeing when you use Hibernate is a 
> Hibernate  specific extension supporting Entities as Map keys when  
> there is no relation between the Map value and Map key.  This is not 
> supported in the JPA 1.0 specification. 
>  EclipseLink will support this type of relationship if there is  a 
> relationship between class1 and class2 and you use the @MapKey 
> annotation like:
> @Entity
> public class Class2 {
>     @Id
>     protected int id;
>     protected String name;
>     @OneToOne
>     protected Class1 class1;
> public class Class3 {
>     @Id
>     protected int id;
>     protected String name;
>     @MapKey(name="class1")
>     @ManyToMany
>     protected Map<Class1, Class2> class2;
> --Gordon

--- James Sutherland
 EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top