title: How to configure mapping programmatically?
body: <p>Our Hibernate configuration mapping have been implemented programatically in <code>java</code>, not with <code>annotation</code> and not with <code>XML</code> mapping.</p>
  
  <p>We have a mapping classes hierarchy that we're setting in the Hibernate Mappings instance when the context is initialized, for instance:</p>
  
  <pre><code>Mappings mappings = configuration.createMappings();
  mappings.addClass(PersistentClass instance);
  </code></pre>
  
  <p>Now, the issue I'm facing with is quite simple but i don't find an example how to add it for our implementation.</p>
  
  <p>Let's say that</p>
  
  <p>we have 2 tables<code>A</code> and <code>B</code> with Many to one relation,
  <code>A.type_id = B.id.</code> and i want to retrieve all records from <code>A</code> with the following condition:
  <code>A.type_id = B.id and B.id = 4;</code></p>
  
  <p>How can i add the association (many to one) in my mapping object. <code>org.hibernate.mapping.RootClass.</code></p>