Hello, I have some problems with OneToMany-Relationships in Entity Beans. When I try to get entries via the corrensponding getter method, the return Collection contains all results twice. I have initalized the Collections as HashSet, why can this happen? Are there some common mistakes I make?
Christoph | public class UserDataEntityBean implements Serializable { | private long id; | private UserEntityBean user; | private Date lastupdate; | private Collection<StudyEntityBean> studies; | | ... | | public UserDataEntityBean() { | this.studies = new HashSet<StudyEntityBean>(); | } | | ... | | @OneToMany(fetch=FetchType.EAGER, cascade = {CascadeType.ALL}, mappedBy="userdata") | public Collection<StudyEntityBean> getStudies() { | return studies; | } | | public void setStudies(Collection<StudyEntityBean> studies) { | this.studies = studies; | } | } | The method called is "getStudies". View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3911828#3911828 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3911828 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user