[jboss-user] [EJB/JBoss] - many-to-many problem when passing collection

mravikrish do-not-reply at jboss.com
Tue Dec 23 04:12:17 EST 2008


 Hi,
     I am ramu, i am getting a problem when persisting data in many to many mapping.

vendor---->industry is many to many mapping

I am taking two industries objects and passing them to one vendor as a collection

Vendor v = manager.find(Vendor.class, 3);
		Industry i = manager.find(Industry.class, 2);
		Industry i1 = manager.find(Industry.class, 3);
		List l1 = new ArrayList();
		l1.add(i);
		l1.add(i1);
		v.setIndustries(l1);
		v.getIndustries().add(i);
		i.getVendors().add(v);
		manager.persist(v);

it is adding only one row in join table.but it should add two records for vendor 3

any help please
Thank you
KRamu


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

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



More information about the jboss-user mailing list