geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhangguop...@gmail.com
Subject What is the reason to use java.util.Collection for many side relationship in JPA?
Date Fri, 22 Feb 2008 02:14:56 GMT
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,

Mime
View raw message