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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -