setting attributes in many to many relations

in my problem i have two entities A , B they have many to many relation

pesodo code

class A

{

//Code

....

Set<B> bs;

}

class B

{

//Code

....

Set<A> as;

}

Session Bean:-

A a = new A();

Set<B> bs = new Set<B>();

bs.add();

a.setBs(B);

entityManager.persist(a);

this is not a real code!!!

i run this code

it added to dataBase the attributes that have one to one mapping or one many, but it didn't add the many to many relation and many to one

i hope that any one understand this problem

i am struggling on it

if any one have a sample code it would be great

Thank's in advance

[766 byte] By [bakr_awada] at [2007-11-27 8:38:04]
# 1
Hint: This code is EJB 3.0
bakr_awada at 2007-7-12 20:35:35 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
O.K. Guysi have managed to solve this problemit was a probelm of the primary key as it is automatic generatedThank's againif any one would like to know the solution of this problemreplay to this post!!!!
bakr_awada at 2007-7-12 20:35:35 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...