Note that there are some explanatory texts on larger screens.

plurals
  1. PONHibernate map a column to a property and a bag
    primarykey
    data
    text
    <p>I'm having some difficulties mapping the following sitation:</p> <p>I have a person with a connection id, I use this to get map a bag and a property. This works if the database already exists. But for our unit tests, we generate one from the schema, it gives an error : "duplicate column names".</p> <p>Here is the mapping:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="DomainLayer.SearchDomain" assembly="Test"&gt; &lt;class name="SearchPerson" table="person" lazy="false" mutable="false"&gt; &lt;id name="Id" column="`id`" type="int"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="Name" column="`NAAM`" type="string" /&gt; &lt;property name="FirstName" column="`VOORNAAM`" type="string" /&gt; &lt;property name="ConnectionId" column="`Koppelid`" type="int" /&gt; &lt;bag name="Languages" lazy="false" mutable="false" access="field.camelcase-underscore"&gt; &lt;key property-ref="ConnectionId" column="Koppelid" /&gt; &lt;one-to-many class="DomainLayer.Person.LanguageSkill, Test" /&gt; &lt;/bag&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>Problem: "Koppelid" both in Key property from the bag as in the property. </p> <p><strong>Edit:</strong></p> <p>The LanguageSkill mapping:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="DomainLayer.Person" assembly="Test"&gt; &lt;class name="LanguageSkill" table="languageskill" lazy="false"&gt; &lt;id name="Id" type="Int32"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="ConnectionId" column="`KoppelId`" type="Int64" /&gt; &lt;property name="Remark" column="`Opmerking`" type="string" /&gt; &lt;property name="Source" column="`CdOorsprong`" type="string" /&gt; &lt;property name="MotherTongue" column="`moedertaal`" type="boolean" /&gt; &lt;property name="ModifiedDate" column="`wyzdat`" type="DateTime" /&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre>
    singulars
    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.
    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