java - Hibernate One To One Bidirectional Not working -


i trying make code have bidrectional relationship(one one) apparently code not working.

here's first class.

public class user {       @onetoone(cascade = cascadetype.all)     @joincolumn(name = "user_profile_fk")     private userprofile userprofile;      //accessor methods , other stuff } 

and second class

@entity @table(name ="user_profile") public class userprofile{       @onetoone(mappedby="userprofile")     private user user;     //accessor methods } 

now when run code exception error occurs

unknown mappedby in: org.test.myapp.user, referenced property unknown: org.test.myapp.user.userprofile 

the field @ other side of association named userprofile, not userprofile, mappedby attribute must set userprofile.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -