You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by zh...@gmail.com on 2008/02/22 03:14:56 UTC

What is the reason to use java.util.Collection for many side relationship in JPA?

Hi,

I want to know the reason why in JPA specs, use java.util.Collection
type for many side relationship in JPA, while not use something like
java.util.Set which does not permit duplicate?
I also saw some sample code that define like:

@Entity(name="CourseBid")
public class Course implements Serializable {
                ........
	private Collection<Student> students = new ArrayList<Student>();

ArrayList permits duplicate. It looks not good when Course.students
contains two reference to the same student?

Thanks,