Made the ID property to be just a regular int instead of a Nullable
Int, but this made no difference what so ever.

I'm pulling out my hairs at the moment it simply does not make any
sense to me >.<

On 12 jul, 09:20, "F.B. ten Kate" <[email protected]> wrote:
> There is no direct relationship, i'm developing a form which fills a
> Entity object, an entity object among other things has
> EntityReactionTypes, when this collection changes (when i add 2 or
> more objects to the collection) and try to Merge() (since the session
> get's closed after retrieving the Entity). In this merge The error is
> thrown, the Entity Mapping is as follows:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>                    assembly="DirectPay.Backoffice.Entities"
>                    namespace="DirectPay.Backoffice.Entities">
>         <class name="Entity" table="tbl_Entiteit">
>                 <id name="ID" column="Entiteit_ID">
>                         <generator class="increment" />
>                 </id>
>                 <property name="Code" column="Entiteit_Code" />
>                 <property name="Comments" column="Opmerkingen" />
>                 <component name="CompanyDetails">
>                         <component name="Address">
>                                 <property name="ZIPCode" 
> column="Vestiging_Postcode"/>
>                                 <property name="Street" 
> column="Vestiging_Adres"/>
>                                 <property name="City" 
> column="Vestiging_Plaats"/>
>                                 <many-to-one name="Country" fetch="join"
> column="Vestiging_Land_ID"/>
>                                 <component name="HouseNumber">
>                                         <property name="Number" 
> column="Vestiging_Huisnummer"/>
>                                 </component>
>                         </component>
>                         <many-to-one name="Branch" fetch="join" 
> column="Branche_ID"/>
>                         <many-to-one name="Sector" fetch="join" column 
> ="Sector_ID"/>
>                         <property name="ChamberOfCommerceNumber" 
> column="KvKNummer"/>
>                         <component name="CorrespondenceAddress" 
> class="Address">
>                                 <property name="ZIPCode" 
> column="Correspondentie_Postcode"/>
>                                 <property name="Street" 
> column="Correspondentie_Adres"/>
>                                 <property name="City" 
> column="Correspondentie_Plaats"/>
>                                 <many-to-one name="Country" fetch="join"
> column="Correspondentie_Land_ID"/>
>                                 <component name="HouseNumber">
>                                         <property name="Number" 
> column="Correspondentie_Huisnummer"/>
>                                 </component>
>                         </component>
>                         <property name="IsLiableToVAT" 
> column="BTWPlichtig_NeeJa"/>
>                         <property name="Name" column="Bedrijfsnaam"/>
>                         <property name="VATNumber" column="BTWNummer"/>
>                         <many-to-one name="TypeOfCompany" fetch="join"
> column="Rechtsvorm_ID"/>
>                 </component >
>                 <set cascade="all-delete-orphan" inverse="true"
> name="ContactPersons">
>                         <key column="Entiteit_ID"></key>
>                         <one-to-many class="ContactPerson"/>
>                 </set>
>                 <component name="ContactInformation">
>                         <property name="FaxNumber" column="Faxnummer"/>
>                         <property name="TelephoneNumber" 
> column="Telefoonnummer"/>
>                         <property name="EmailAddress" column="Email"/>
>                 </component>
>                 <!--<property name="DateLastEdited" column="DatumWijziging"/>
>                 <property name="IsActive" column="Actief_NeeJa"/>-->
>                 <property name="SearchCode" column="Zoekcode"/>
>                 <property name="SortName" column="Sorteernaam"/>
>                 <set name="BankAccounts" cascade="all-delete-orphan" 
> inverse="true">
>                         <key column="Entiteit_ID"></key>
>                         <one-to-many class="BankAccount"/>
>                 </set>
>                 <one-to-one name="EntityDashboard" constrained="false"/>
>                 <one-to-one name="Contract" constrained="false"/>
>                 <set name="EntityReactionTypes" cascade="all-delete-orphan"
> inverse="true">
>                         <key column="Entiteit_ID"></key>
>                         <one-to-many class="EntityReactionType"/>
>                 </set>
>         </class>
> </hibernate-mapping>
>
> On 9 jul, 17:39, Fabio Maulo <[email protected]> wrote:
>
> > I can't see the relation between the class you sent us and the mapping you
> > sent us.
> > The class has a Nullable<int> as POID but in the mapping you are using a
> > composite ID.
>
> > On Fri, Jul 9, 2010 at 12:02 PM, F.B. ten Kate <[email protected]> wrote:
>
> > > That has to do with the fact i didn't (and still don't) wanna use
> > > DTO's, while using these object in webservices. Since the objects
> > > don't have (or need) and id when they are send to the server to be
> > > inserted we made it a nullable int.
>
> > > It hasn't been a problem before so i doubt it is now.
>
> > > I'm not able to pin point the problem, it seems the exception is
> > > thrown from NHibernate itself so might actually be a bug. But it's
> > > frustrating the hell out of me.
>
> > > If i had to gues it has something to do with the following mapping:
>
> > > <class name="EntityReactionType" table="tbl_Entiteit_Reactie_Type">
> > >                <composite-id>
> > >                        <key-many-to-one name="Entity" column="Entiteit_ID"
> > > class="Entity"/
>
> > >                        <key-many-to-one name="ReactionType"
> > > column="Reactie_Type_ID"
> > > class="ReactionType"/>
> > >                </composite-id>
> > >                <property name="Text" column="Omschrijving"/>
> > >                <set name="PossibleResponses"
> > > table="tbl_Entiteit_Response_Reactie_Type" batch-size="50">
> > >                        <key>
> > >                                <column name="Bron_Entiteit_ID"
> > > sql-type="int"/>
> > >                                <column name="Bron_Reactie_Type_ID"
> > > sql-type="int"/>
> > >                        </key>
> > >                        <many-to-many class="EntityReactionType">
> > >                                <column name="Response_Entiteit_ID"/>
> > >                                <column name="Response_Reactie_Type_ID"/>
> > >                        </many-to-many>
> > >                </set>
> > >        </class>
>
> > > Since atm for some reason NHibernate is having a hard time inserting
> > > the correct values, for some reason it NULLs the Entity and
> > > ReactionType, not sure why and this might be unrelated but somehow i
> > > doubt that. Maybe NHibernate is NULLing the values somewhere and
> > > expecting them to not be null and trying to call a property/method
> > > somewhere else (thus causing some errors).
>
> > > On 9 jul, 16:47, kor <[email protected]> wrote:
> > > > why id is nullable? maybe the problem is that
>
> > > > anyhow put same log to identify when this exception is thrown,
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "nhusers" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<nhusers%[email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/nhusers?hl=en.
>
> > --
> > Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to