I think what you really want is a bag ;)

Andrew Murphy wrote:

I have converted a number of one-to-many association mappings that
previously used a  java.util.Set over to java.util.List, and in the
corresponding 'parent' DAO class I now have the accessor and mutator methods
using a List.

This has introduced unexpected consequences, one being that the collection
returned by the accessor method in the parent class [e.g. public List
getChildren() {return children;}] returns a list containing references to
objects associated with the parent (which is what is expected) *plus* NULL
references for every other child that does not match the parent id (which is
not what I expected). Previously where I used a Set mapping only the unique
objects associated with the parent where returned, i.e. there was an
implicit DISTINCT operation.

I don't know if I am missing something here but what is the point of using a
List if you could potentially have a collection with potentially thousands
of null references and a couple of references to the objects needed?

Any guidance will be appreciated.

Regards, Andrew Murphy





-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

-- Gavin King JBoss Group +61 410534454 http://hibernate.org



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to