http://fabiomaulo.blogspot.com/2008/12/identity-never-ending-story.html

Fabio Maulo said:

In addition I want say that using *identity *you are “disabling” the
> ADO-batcher NH’s feature for inserts.



Try HiLo



2010/4/23 José F. Romaniello <[email protected]>

> You are doing it wrong.
> Can you see the problem? How can you talk about *batchsize* and show this
> nasty thing
>
>
> <sql-insert>
>      INSERT INTO [Price]
>      ([EffectiveDate]
>      ,[CurrencyId]
>      ,[UnitOfPriceId]
>      ,[AgreementId]
>      ,[Amount]
>      ,[PriceStatusId])
>      VALUES
>      (?,?,?,?,?,?);
>      select SCOPE_IDENTITY()
>    </sql-insert>
>
>
> 2010/4/23 robcar <[email protected]>
>
> Sorry if this looks bad (I'm a newbie in posting questions here
>> too :-)
>>
>> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>> assembly="Entities" namespace="Entities">
>>  <class name="Price" table="[SelectPricesView]">
>>
>>    <id name="PriceId" column="PriceId" type="System.Int32" unsaved-
>> value="0">
>>      <generator class="identity"/>
>>    </id>
>>
>>    <property name="EffectiveDate" column="EffectiveDate" not-
>> null="true" type="System.DateTime"  insert="true" update="true"/>
>>    <property name="NextEffectiveDate" column="NextEffectiveDate" not-
>> null="true" type="System.DateTime" insert="false" update="false"/>
>>    <many-to-one name="Currency" fetch="select" lazy="proxy" not-
>> null="true" outer-join="auto" insert="true" update="true">
>>      <column name="CurrencyId"/>
>>    </many-to-one>
>>    <many-to-one name="UnitOfPrice" lazy="false" fetch="select" not-
>> null="true" outer-join="auto" insert="true" update="true">
>>      <column name="UnitOfPriceId"/>
>>    </many-to-one>
>>    <many-to-one name="Agreement" fetch="join" not-null="true" outer-
>> join="auto" insert="true" update="true">
>>      <column name="AgreementId"/>
>>    </many-to-one>
>>    <one-to-one name="PriceSearchFacilitator"
>> class="PriceSearchFacilitator" fetch="join"/>
>>    <set name="PreviousPriceSearchFacilitator" inverse="true"
>> cascade="none" lazy="true" fetch="subselect" generic="true" >
>>      <key column="PreviousPriceId" />
>>      <one-to-many class="PreviousPriceSearchFacilitator"/>
>>    </set>
>>
>>    <!--<one-to-one name="PreviousPriceSearchFacilitator"
>> class="PreviousPriceSearchFacilitator" fetch="join"/>-->
>>    <property name="Amount" column="Amount" not-null="true"
>> type="System.Decimal"  insert="true" update="true"/>
>>    <property name="Status" column="PriceStatusId" not-null="false"
>> insert="true" update="true"/>
>> <!--      <set name="CostComponents" inverse="true" cascade="all-
>> delete-orphan" lazy="true" fetch="subselect" generic="true" >-->
>>      <set name="CostComponents" inverse="true" cascade="all-delete-
>> orphan" lazy="false" fetch="join" generic="true" >
>>          <key column="PriceId" />
>>        <one-to-many class="CostComponent"/>
>>      </set>
>>
>>    <sql-insert>
>>      INSERT INTO [Price]
>>      ([EffectiveDate]
>>      ,[CurrencyId]
>>      ,[UnitOfPriceId]
>>      ,[AgreementId]
>>      ,[Amount]
>>      ,[PriceStatusId])
>>      VALUES
>>      (?,?,?,?,?,?);
>>      select SCOPE_IDENTITY()
>>    </sql-insert>
>>    <sql-update>
>>      UPDATE [Price]
>>      SET [EffectiveDate] = ?
>>      ,[CurrencyId] = ?
>>      ,[UnitOfPriceId] = ?
>>      ,[AgreementId] = ?
>>      ,[Amount] = ?
>>      ,[PriceStatusId] = ?
>>      WHERE PriceId = ?
>>    </sql-update>
>>    <sql-delete>
>>      DELETE FROM [Price]
>>      WHERE PriceId=?
>>    </sql-delete>
>>
>>  </class>
>>
>>
>>  <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>> assembly="Entities" namespace="Entities">
>>  <class name="CostComponent" table="CostComponent" abstract="true"
>> discriminator-value="null" >
>>    <id name="CostComponentId" column="CostComponentID"
>> type="System.Int32" unsaved-value="0">
>>      <generator class="identity"/>
>>    </id>
>>    <discriminator column="IsIncluded" type="System.Boolean"/>
>>
>>    <property name="Amount" column="Amount" not-null="true"
>> type="System.Decimal"  insert="true" update="true"/>
>>    <many-to-one name="Type" fetch="select" lazy="false" not-
>> null="true" outer-join="auto" insert="true" update="true">
>>      <column name="CostComponentTypeId"/>
>>    </many-to-one>
>>
>>    <many-to-one name="Price" column="PriceId" not-null="true"/>
>>
>>    <subclass discriminator-value="True" name="IncludedCostComponent">
>>    </subclass>
>>
>>    <subclass discriminator-value="False" name="AddedCostComponent">
>>    </subclass>
>>
>>  </class>
>>
>> </hibernate-mapping>
>>
>> On 23 Apr, 14:55, José F. Romaniello <[email protected]> wrote:
>> > Can you show the mappings?
>> >
>> > --
>> > 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 athttp://
>> groups.google.com/group/nhusers?hl=en.
>>
>
>

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