I have a problem when I try to use "many to many" relationship
the mapping works
I have 2 classes: client-Supplier, that contains "communication"
and other class: communication
when I do:
HibernateUtil.getSessionFactory();
Enterprise con = new Enterprise ();
con.setName("restg");
con.setId(5);
Communication communication = new Communication ();
communication .setType('E');
communication .setValue("asaas@hsas.com");
Client_Supplier client = new Client_Supplier();
client.setCodP(2121);
Set children = new HashSet();
children.add(communication);
client.setCommunication(children);
client.setCondition(con);
client.setAddress("dsdasd");
try {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
Transaction transaction = session.beginTransaction();
Client_SupplierTest cp = new Client_SupplierTest (session);
ConditionDAO conD = new ConditionDAO(session);
conD.saveCondition(con);
session.save(cp);
transaction.commit();
} catch (Exception ex) {
ex.printStackTrace();
}
the problem is that save in client_suppliers table and nothing in communication table.
what's the problem?