-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: many-to-many association table
PostPosted: Thu Feb 03, 2005 6:02 pm 
Newbie

Joined: Mon Feb 16, 2004 11:28 pm
Posts: 16
My mapping is working correctly as far as I can tell because the database is set up appropriately.

I have a situation where I have an employee table, a skills table, and an employee_skills table. The employee_skills table is a cross reference between the employee and skills tables.

My delima is this. Can I do the following.

Set set = new HashSet();
Skill s = new Skill();
s.setName("Coding");
set.add(s);

Employee e = new Employee();
e.setSkill(skillSet);

session.saveOrUpdate(e);

I'm getting a NullPointerException in the hashCode method of Skill. Looks like the id field in Skill is null(i.e. the key wasn't generated yet).

My question is do I have to save Skill first and then save employee?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.