There is a rule of thumb in NH when you write a mapping:
*don't try to be clear because it will be more dark*

Clean your mapping, on both side, and try again.

2010/3/9 Alexander Muylaert <[email protected]>

> Hi
>
> We are currently using Nhibernate in a test environment.  As newbies
> we are having some newbie issues.
>
> We were able to disable lazy loading on a class and even enable eager
> loading on a set.  This all works nice, we checked the sql statements,
> but those statements are a bit weird.
>
> The statement fetches the primary and foreign key properties for the
> details multiple times.  Since this doesn't add much to anything, this
> cannot be by design and therefor I can assume we are doing something
> wrong.
>
> What are we doing wrong, causing NHibernate to generate jibberisch
> SQL?
>
> Please shed a light on my issues.
>
> Thanks
>
> Alexander
>
> --SQL generated--
> SELECT  capitalize0_.ID as ID0_1_,
>        capitalize0_.PersistenceVersion as Persiste2_0_1_,
>        capitalize0_.RetirementCapital as Retireme3_0_1_,
>        m_capitali1_.CapitalizedAccountId as Capitali6_3_,
>        m_capitali1_.ID as ID3_,
>        m_capitali1_.ID as ID1_0_,
>        m_capitali1_.PersistenceVersion as Persiste2_1_0_,
>        m_capitali1_.CapitalizedAmount as Capitali3_1_0_,
>        m_capitali1_.StartDate as StartDate1_0_,
>        m_capitali1_.EndDate as EndDate1_0_,
>        m_capitali1_.CapitalizedAccountID as Capitali6_1_0_
> FROM    dbo.CapitalizedAccount capitalize0_
>        left outer join dbo.CapitalizedAccountSlice m_capitali1_ on
> capitalize0_.ID = m_capitali1_.CapitalizedAccountId
> WHERE   capitalize0_.ID = @p0
>
> -- bbm file --
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping
>  xmlns="urn:nhibernate-mapping-2.2"
>  assembly="PensioB.Payments"
>  namespace="PensioB.Payments.Semantics_I.Domain"
>  schema="dbo"
>  default-cascade="none"
>  default-access="field">
>
>  <!--dynamic updat required for optimistic locking strategy-->
>  <class
>    name="CapitalizedAccount"
>    table="CapitalizedAccount"
>    mutable="true"
>    lazy="false"
>    dynamic-insert="false"
>    select-before-update="false"
>    dynamic-update="true"
>    optimistic-lock="version">
>
>    <id
>      name="m_PersistenceId"
>      column="ID"
>      unsaved-value="null" >
>      <generator class="identity" />
>    </id>
>
>    <version
>      name="m_PersistenceVersion"
>      column="PersistenceVersion"
>      unsaved-value="null"
>      generated="never" />
>
>    <property
>      name="m_RetirementCapital"
>      column="RetirementCapital"
>      not-null="false"
>      length="50" />
>
>    <set name="m_CapitalizedAccountSlices" cascade="all"
> inverse="true" lazy="false" outer-join="true">
>      <key column="CapitalizedAccountId" />
>      <one-to-many class="CapitalizedAccountSlice" />
>    </set>
>
>    <set name="m_CapitalizedAccountParts" cascade="none"
> inverse="true" >
>      <key column="CapitalizedAccountId" />
>      <one-to-many class="CapitalizedAccountPart" />
>    </set>
>
>  </class>
>
> </hibernate-mapping>
>
> --
> 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