No idea, sorry. What happens if you take the duplicated column out of the
component? Do the updates stop happening?

On Mon, Mar 23, 2009 at 1:12 PM, epitka <[email protected]> wrote:

>
> Anybody?
>
> On Mar 20, 11:02 am, epitka <[email protected]> wrote:
> > Inverse is not valid on <many-to-one tag and in the parent I do not
> > have collection mapped at all. Here is the mapping for the parent,
> > which is really not a parent, it is just an xref for codes. Maybe
> > <many-to-one is not appropriate for this?
> >
> >             WithTable("AcctTypeRef");
> >
> >             DefaultAccess.AsCamelCaseField(Prefix.Underscore);
> >
> >             Id(x => x.Code).Access.AsLowerCaseField
> > (Prefix.Underscore).TheColumnNameIs("AcctTypeCd");
> >
> >             Map(x => x.Description).ColumnName("AcctTypeDescTxt");
> >             Map(x => x.IsDefault).ColumnName("DefaultInd").CustomTypeIs
> > ("YesNo");
> >             Map(x => x.SortOrder).ColumnName("DisplayOrderNum");
> >
> > On Mar 20, 10:40 am, Ayende Rahien <[email protected]> wrote:
> >
> > >http://nhprof.com/Learn/Alert?name=SuperfluousManyToOneUpdate
> >
> > > On Fri, Mar 20, 2009 at 11:35 AM, epitka <[email protected]>
> wrote:
> >
> > > > I have some funky mapping going on here due to legacy db and code.
> > > > Basically there is a composite Id that has a column that is also part
> > > > of the component.
> > > > NH creates update statement even though I specified that no update
> > > > should be performed on the component, and no insert on one of the
> > > > columns in the component as it is part of the composite id. Not sure
> > > > if this is a bug or I need to specify something extra in mapping
> file?
> > > > Column in question is EffectiveDate.
> >
> > > > Here is the mapping:
> >
> > > > <?xml version="1.0" encoding="utf-8" ?>
> > > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> > > > schema="PRDPROD.dbo" auto-import="false">
> > > >  <class name="SR.Domain.Client.Entities.ClientAccountTypeHistoryItem,
> > > > SR.Domain"
> > > >         table="ClientAcctType" lazy="true">
> >
> > > >    <composite-id name="Id"
> > > >        class="SR.Domain.Client.Entities.ClientAccountTypeCompositeID,
> > > > SR.Domain"
> > > >         access="field.lowercase">
> > > >      <key-property
> > > >          name="ClientID"
> > > >          column="ClientId"
> > > >          type="Int32"/>
> > > >      <key-property
> > > >          name="EffectiveDate"
> > > >          column="EffDt"
> > > >          type="DateTime"/>
> > > >    </composite-id>
> > > >    <many-to-one name="AccountType" access="nosetter.camelcase-
> > > > underscore"
> > > >                 class="SR.Domain.Client.Values.AccountType,
> > > > SR.Domain" column="AcctTypeCd">
> > > >    </many-to-one>
> >
> > > >    <!-- define a component for DataRange-->
> > > >    <component access="nosetter.camelcase-underscore"
> > > >               name="Effective"
> > > > class="SR.Domain.Common.Values.DateRange, SR.Domain" insert="true"
> > > > update="false">
> > > >      <property column="EffDt" name="Start" type="DateTime"
> > > > insert="false"></property>
> > > >      <property column="ExpDt" name="End" type="DateTime"
> > > > insert="true" ></property>
> > > >    </component>
> > > >  </class>
> > > > </hibernate-mapping>
> >
> > > > and here is the log
> >
> > > > DEBUG NHibernate.SQL SELECT accounttyp0_.ClientId as ClientId1_,
> > > > accounttyp0_.EffDt as EffDt1_, accounttyp0_.ClientId as ClientId4_0_,
> > > > accounttyp0_.EffDt as EffDt4_0_, accounttyp0_.AcctTypeCd as
> > > > AcctTypeCd4_0_, accounttyp0_.ExpDt as ExpDt4_0_ FROM
> > > > PRDPROD.dbo.ClientAcctType accounttyp0_ WHERE
> > > > accounttyp0_.client...@p0; @p0 = '4056'
> > > > DEBUG NHibernate.SQL INSERT INTO PRDPROD.dbo.ClientAcctType
> > > > (AcctTypeCd, ExpDt, ClientId, EffDt) VALUES (@p0, @p1, @p2, @p3); @p0
> > > > = 'COMM', @p1 = '1/1/2010 12:00:00 AM', @p2 = '4056', @p3 = '1/1/1990
> > > > 12:00:00 AM'
> > > > DEBUG NHibernate.SQL UPDATE PRDPROD.dbo.ClientAcctType SET ClientId =
> > > > @p0, EffDt = @p1 WHERE ClientId = @p2 AND EffDt = @p3; @p0 = '4056',
> > > > @p1 = '1/1/1990 12:00:00 AM', @p2 = '4056', @p3 = '1/1/1990 12:00:00
> > > > AM'
> >
>

--~--~---------~--~----~------------~-------~--~----~
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