Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to map correctly over two tables in hibernate
    primarykey
    data
    text
    <p>I have two Mapping files. Building and ContactPerson. Each Buildung has one ContactPerson. So i have done a one-to-one relationship</p> <p>In Building i have the column "Meetingplace" and in Contact i have the columns "Meetingplace" and "ContactpersonName"</p> <p>In Contact i assign a Contactperson to a Meetingplace. </p> <p>For example: Meetingplace in Building is Germany. Now in Contact i assign a Contactperson to Meetingplace Germany. </p> <p>Contact:</p> <p>Here are my Mappingfiles</p> <pre><code> &lt;class name="Book.Doa.Contact" table="Contact"&gt; &lt;id name="ID"&gt; &lt;generator class="foreign"&gt; &lt;param name="property"&gt;Parent&lt;/param&gt; &lt;/generator&gt; &lt;/id&gt; &lt;property name="Contact" length="20" column="Contactperson"/&gt; &lt;property name="Meeting" length="20" column="Meetingplace"/&gt; &lt;one-to-one name="Parent" class="Book.Doa.Building" constrained="true"/&gt; </code></pre> <p>Building:</p> <pre><code> &lt;class name="Book.Doa.Building"&gt; &lt;id name="ID"&gt; &lt;generator class="native"&gt; &lt;param name="sequence"&gt;GLOBALSEQUENCE&lt;/param&gt; &lt;/generator&gt; &lt;/id&gt; &lt;property name="Standort" column="Meetingplace" /&gt; &lt;one-to-one name="Partner" lazy="false" cascade="all" fetch="join" outer-join="true" class="BookIt.Domain.Contact, BookIt.Core" /&gt; &lt;/class&gt; </code></pre> <p>My problem ist that iam geeting alwas the Error: </p> <pre><code>Object reference not set to instance of an object </code></pre> <p>if i use room.Building.Partner.Contact to get the Contactperson for Meetingplace in Building.</p> <p>There are values in the Database so i dont know why iam getting that error. What iam doing wrong? The Questions is how can i get the ContactPerson for the Meetingplace in Bulding?</p> <p>Please Help! .</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload