The messages indicate, that you do not have your primary key set correctly. I think you
have to do that manually. It's a bit tricky, as your primary key for skill level is a
composition of two foreign keys. I think you have to correct that...
I solved the problem by adding @Column (in the primary key class) and @JoinColumn (for
your releationships) and @AttributeOverride (for your embedded primary key) annotation.
For the JoinColumn, I had to set insertable and updateable to false, as the columns will
be generated by the primary key. Use the same names for the columns in your primary key
class as for the JoinColumns. I guess hibernate will have created distinct columns for
your primary key and your relationship definition, but that's not what you really
wanted. Check your schema to see what hibernat actually does on database level!
Before saving your entities, be sure to set all fields of your bean. The primary key AND
your relation fields - this feels like doing a little bit of work twice, but I think it
turns out to be correct.
For your relationships, try to find the correct settings for cascading. E.g, when you
remove a vendor, you will also want that all skill levels for that vendor be removed. When
you remove a skill, you may want that all skill levels be removed. Either use cascading or
do it manually in your code.
Good luck!
Jochen
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4220099#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...