openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cedric Hurst <>
Subject Re: Using a Maps instead of Sets to handle @ManyToMany?
Date Sun, 27 Jan 2008 00:07:31 GMT


Thanks for the tips and I apologize for taking so long to respond.  After
investigating both @PersistentMap and @MapKey options, I don't believe that
either mechanism will really solve my problem.  @PersistentMap comes the
closest, and it would work if I had a @OneToMany relationship.  But with
@ManyToMany, I need an inner collection on the value side of the
@PersistentMap to hold the associated object references.  @PersistentMap
would need further metadata to properly marshall the inner collection and I
don't see a way of providing that information to the interface.

The best approach is probably to explicitly define the associative entity as
a top-level @Entity class, with @OneToMany relationships on both sides. 
While this makes querying a bit tougher, I might be able to build some
@Transient methods in my Customer and Address classes to make object
traversal less painful.

- C

P.S.  I saw your new tutorials in the OpenEJB list and they look great!
View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message