title: How to write many to one relationship for below scenario hibernate
body: <p><strong>User table</strong></p>
  
  <pre><code>id -pk
  name
  groupname
  roleid
  </code></pre>
  
  <p><strong>UserGroup</strong></p>
  
  <pre><code>id -pk
  name
  description
  roleid
  </code></pre>
  
  <p>In above tables, <strong>groupname</strong> and <strong>roleid</strong> is non-primary fields in <strong>user table</strong> has relationship with <strong>name</strong> and <strong>roleid</strong> in <strong>usergroup table</strong></p>
  
  <p><strong>Question here is</strong> : how to write many to one relationship(user->usergroup) in user.hbm.xml</p>