What if Person P steals car C?  If I were the police I would want to know he stole it three times.  :-) Although in most cases I would tend toward a Set before collections, Logging is one of the areas where P &C being the key could exist multiple times and I would want the information.  I would hope that you datasource would not have duplicate records in it anyway. :-)
-----Original Message-----
From: Randahl Fink Isaksen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 9:12 AM
To: Orion-Interest
Subject: When to use java.util.Collection or java.util.Set

Hi everybody



I noticed in the EJB 2.0 specification that most of the examples use java.util.Collection when defining a relationship between two entities, even though java.util.Set is also allowed.


Why is that so?


I would expect java.util.Set to be the most frequently used type, since in general you would not want duplicates in a relationship. Think of a Person-owns-Car relationship for instance - you are not interested in any duplicates here, since a Person cannot own the same car twice so to speak (if one relationship says that person P is the owner of car C, it does not provide you with any usefull information to create yet another relationship between P and C).


Which cmr-field-types do you use and why?





Reply via email to