users@glassfish.java.net

Re: More columns in 'ManyToMany' JoinTable

From: <glassfish_at_javadesktop.org>
Date: Mon, 12 Feb 2007 11:57:00 PST

> 1)
> What is the best practive of managing additional
> columns in the JoinTable of ManyToMany relationships
> entities.

>
> I assume I can create another entity such as
> UserGroup for that, but maintanance grows that way
> since I need extra columsn in JoinTables in many
> places...

Some providers might provide an extended functionality, where a relationship with additional attributes can be mapped as java.util.Map. The key would be the related object, and the value an Object[] of the attribute values.

This is *extendend* functionality, making your application non-portable.

> 2) If one of the 'User' or 'Group' objects being
> removed, the relationship remains. is there any way
> to automatically remove the relationship? I do not
> want to remove the connected -objects-, only the
> relationships when one of the sides being removed.

This is dependent on the persistence provider, too. The portable way is to remove the relationships manually.
[Message sent by forum member 'mf125085' (mf125085)]

http://forums.java.net/jive/thread.jspa?messageID=203498