|
I have many-to-many relationship between User and Role entities in my DB schema. That is done through UserRole table. User-UserRole-Role
I use @JoinTable annotation to join all roles of a user. Roles are fetching correctly, but when i try to persist new user with a set of roles i get an error:
2015-07-08 12:07:08 ERROR SqlExceptionHelper:146 - NULL not allowed for column "ID"; SQL statement: insert into T_USER_ROLE (USER_ID, ROLE_ID) values (?, ?) [23502-176]
Because the generated insert script does not use sequence generator and does not provide T_USER_ROLE.ID value.
But if i persist UserRole directly in my code it works.
Please find a test case attached. Best regards, Alexey.
|