Results 1 to 2 of 2
Thread: many to many problems
- 08-01-2007, 01:49 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 33
- Rep Power
- 0
many to many problems
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:
the problem is that save in client_suppliers table and nothing in communication table.Java Code: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(); }
what's the problem?
- 08-02-2007, 05:51 PM #2
Member
- Join Date
- Jul 2007
- Posts
- 41
- Rep Power
- 0
Similar Threads
-
Problems in JSP : Need help
By raj4u in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 02-07-2008, 10:06 AM -
GUI problems.
By saytri in forum New To JavaReplies: 1Last Post: 12-16-2007, 10:27 PM -
gui problems
By bluebirdjc in forum Advanced JavaReplies: 2Last Post: 07-23-2007, 05:38 PM -
a few problems
By gary in forum AWT / SwingReplies: 0Last Post: 07-11-2007, 04:57 PM -
problems with JPA
By Ed in forum New To JavaReplies: 2Last Post: 07-04-2007, 05:34 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks