• Post Reply Bookmark Topic Watch Topic
  • New Topic

Persist 1-m entities with in hibernate  RSS feed

 
Harshana Dias
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have below 1-m relationship on entities which Mentor to Students. The mentor has composite primary key which i use as foreign key in student.





How can I persist the mentor with students?

Students own the relationship because foreign keys resides on Students side.



But it gave me "EntityNotFoundException: Unable to find com.ejb.entities.Mentor with id com.ejb.entities.MentorPK@c22".

Then i persist the mentor before save student. Then i got cannot insert NULL into ("SYS"."STUDENT"."ADDRESS_FK").

Note: In mentor class I have try use @EmbeddedId also instead of @Id. But still problem exists.
 
Harshana Dias
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any thoughts?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!