-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem in Using Index column
PostPosted: Mon Sep 25, 2006 11:34 am 
Newbie

Joined: Mon Sep 25, 2006 10:51 am
Posts: 1
Hi,

I am new to Hibernate, I am trying to fix a bug which was build by someone else. The problem is we are using a PartyIndex column which is an index. The application is suppose to insert an integer to this field to make the row unique, since there is a possiblity that rows can be duplicate. The code works for most of the condition and we see some errors.

The issue happens for some reason the database gets duplicate PartyIndex value, so if there are 10 rows and 2 rows with duplicate values including the partyIndex, while getting the data from the database Nhibernate returns only 8 rows instead of 10 even though the query looks good and when we test the query it returns 10 rows.


Hibernate version:
NHibernate for Microsoft .NET Framework 1.1
Version 1.0.2.0

Mapping documents:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<!-- ==================================================================== -->
<!-- Order Domain Object Mapping -->
<!-- ==================================================================== -->
<class name="Emsi.Order.Data.DomainModel.Order, Emsi.Order.Data"
table="Orders" dynamic-insert="true" dynamic-update="true">
<id name="Id" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>

<property name="CarrierId" type="Nullables.NHibernate.NullableInt32Type,
Nullables.NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc"/>

<property name="SubmittedDate" type="DateTime">
<column name="SubmittedDate" index="SubmittedDateIndex" not-null="true"/>
</property>

<property name="Originator" type="String">
<column name="Originator" index="OriginatorIndex" length="32" not-null="true"/>
</property>

<many-to-one name="StateCode" outer-join="false"
class="Emsi.Order.Data.DomainModel.OrderStateCode, Emsi.Order.Data">
<column name="StateCodeId" not-null="true"/>
</many-to-one>

<many-to-one name="Policy" cascade="save-update"
class="Emsi.Order.Data.DomainModel.Policy, Emsi.Order.Data">
<column name="PolicyId" index="PolicyIndex"/>
</many-to-one>

<bag name="Requirements" inverse="true" lazy="true" batch-size="15" order-by="Id asc" cascade="all">
<key column="OrderId"/>
<one-to-many class="Emsi.Order.Data.DomainModel.Requirement, Emsi.Order.Data"/>
</bag>

<bag name="RequirementRelations" lazy="true" batch-size="15" cascade="all-delete-orphan">
<key>
<column name="OrderId" index="OrderIndex"/>
</key>
<one-to-many class="Emsi.Order.Data.DomainModel.RequirementRelation, Emsi.Order.Data"/>
</bag>

<list name="Parties" lazy="true" batch-size="15" cascade="all">
<key>
<column name="OrderId" index="OrderIndex"/>
</key>
<index column="PartyIndex" />
<one-to-many class="Emsi.Common.Data.DomainModel.Party,
Emsi.Common.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=580198cfe1c15b95"
/>
</list>

<set name="PartyRoles" lazy="true" batch-size="15" cascade="all-delete-orphan">
<key>
<column name="OrderId" index="OrderIndex" lazy="true"/>
</key>
<one-to-many class="Emsi.Order.Data.DomainModel.OrderPartyRole, Emsi.Order.Data"/>
</set>

<bag name="Transactions" lazy="true" batch-size="15" order-by="Id asc" cascade="all-delete-orphan">
<key>
<column name="OrderId" index="OrderIndex"/>
</key>
<one-to-many class="Emsi.Order.Data.DomainModel.OrderTransaction, Emsi.Order.Data"/>
</bag>

<property name="ProcessMode" type="string" length="32"/>

<map name="ExtendedProperties" batch-size="15" table="OrderProperties"
lazy="true" cascade="all">
<key column="OrderId"/>
<index column="Name" type="string" length="50"/>
<element column="Value" type="string" length="50" not-null="true"/>
</map>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
N/A
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
SQL Server 2000
The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
N/A

Thanks for your help.


Muthu


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.