openjpa-users mailing list archives

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

Alexander,

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.

Best,
- C

P.S.  I saw your new tutorials in the OpenEJB list and they look great!
-- 
View this message in context: http://www.nabble.com/Using-a-Maps-instead-of-Sets-to-handle-%40ManyToMany--tp14743250p15114397.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message