java - How to write many to one relationship for below scenario hibernate -


user table

id -pk name groupname roleid 

usergroup

id -pk name description roleid 

in above tables, groupname , roleid non-primary fields in user table has relationship name , roleid in usergroup table

question here is : how write many 1 relationship(user->usergroup) in user.hbm.xml

consider searching "hibernate @onetoone example".

regarding foreign keys, consider keeping usergroup_id in user table instead of "groupname".


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

What is happening when Matlab is starting a "parallel pool"? -

php - Cannot override Laravel Spark authentication with own implementation -