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