[jboss-user] [EJB 3.0] - Using ManyToMany Relationship

abhimany do-not-reply at jboss.com
Mon Jun 9 04:48:39 EDT 2008


Hi Everyone,

I am using ManyToMany bidirectional relationship, fragment of code is given below for help:

In One Entity i am coding as:

@ManyToMany(cascade=CascadeType.REFRESH, fetch=FetchType.EAGER)        
	@JoinTable(name="trd_t_sess_nommem",joinColumns = @JoinColumn(name="trs_trnsessnid_n_fk"),inverseJoinColumns = @JoinColumn(name="tnm_nommemid_n_fk"))
	public Set getNominatedmembersentity(){
		return nominatedmembersentity;
	}
	/**
	 * @param nominatedmembersentity the nominatedmembersentity to set
	 */
	public void setNominatedmembersentity(
			Set nominatedmembersentity) {
		this.nominatedmembersentity = nominatedmembersentity;
	}

At other entity i am coding as given below:


@ManyToMany(mappedBy="nominatedmembersentity")
	public List getTrainingsessionentity() {
		return trainingsessionentity;
	} 


But at the built time i am receiving the following error:


--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: persistence.units:ear=training.ear,jar=training.jar,unitName=intro
  State: FAILED
  Reason: javax.persistence.PersistenceException: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
  I Depend On:
    jboss.jca:service=DataSourceBinding,name=PostgresDS

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156603#4156603

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4156603



More information about the jboss-user mailing list