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?
|