java - Composite primary key with not primitive attributes -


i new java , hibernate. i've got problem composite key. trying that:

@entity class {     @id     int id; }  @entity class b {     @id     int id; }   @entity class c {     @embeddedid     c_pk c_pk; }  @embeddable class c_pk {     a;     b b; } 

when perform

... session.save(c); ... 

then exception thrown type of , b cannot inserted database. possible somehow tell hibernate don't save object id? approach absolutely wrong , should use primitive data types @ c_pk class?

you should put @manytoone (or onetoone) join columns on , b references in c_pk.

@embeddable class c_pk {     @manytoone     a;     @manytoone     b b; } 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -