hibernate - JPA @OneToMany relationship to @Embedded class used as @Id -


i have problem (and i'm not sure if possible) whit association , embedded id using jpa...

i have person class it's id:

@entity public class person{     @embeddedid     private personcode personcode;     private string name;      @embeddable     public static class personcode{         private string code;     } } 

and create class company association:

@entity public class company{     private string name;      @onetomany     private list<personcode> employees; } 

but have exception:

caused by: org.hibernate.annotationexception: use of @onetomany or @manytomany targeting unmapped class: example.domain.company.employees[example.domain.person$personcode] 

an association must between 2 entities. company should have list<person>.

btw, make harder necessary. use

@entity public class person{     @id     private string code;      private string name; } 

there's no reason wrap single field embeddable class.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -