-->
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.  [ 2 posts ] 
Author Message
 Post subject: I need help with "No row with the given identifier exis
PostPosted: Tue Oct 09, 2007 8:30 pm 
Newbie

Joined: Mon Oct 16, 2006 11:33 am
Posts: 3
My scenario: NHibernate v1.0.2.0 | SQL Server 2000 | VB.NET 2005.

My problem:

I am trying to obtain all articles of the table, but it gives the following exception:

"No row with the given identifier exists: 249, of class: Article".

ID 249 don't exist in the articles table and I do not understand because it tries to bring this ID.

From where obtains this ID?

Try different consultations and in all I such obtain results with values that are not either in the table.

My map file:

************************************************************************************************
<class name="Article" table="Articles">

<id name="_id" column="ID" unsaved-value="0" access="field">
<generator class="identity" />
</id>

<many-to-one name="_supplier" column="SupplierID" update="true" access="field" />

<property name="_supplierPrice" column="SupplierPrice" access="field"/>
<property name="_articletype" column="ArticleType" access="field"/>
<property name="_code" column="Code" access="field"/>
<property name="_name" column="Name" access="field"/>
<property name="_unit" column="Unit" access="field"/>
<property name="_image" column="Image" access="field" type="BinaryBlob"/>
<property name="_specs" column="Specs" access="field"/>
<property name="_isComponent" column="IsComponent" access="field"/>
<property name="_active" column="Active" access="field"/>

<bag name="_components" cascade="all" access="field" inverse="true" lazy="false">
<key column="ArticleID" />
<one-to-many class="ArticleComponent" />
</bag>

</class>

<class name="ArticleComponent" dynamic-update="true" table="ArticlesComponents">

<id name="_id" column="ID" unsaved-value="0" access="field">
<generator class="identity" />
</id>

<many-to-one name="_article" cascade="none" column="ArticleID" access="field" />
<many-to-one name="_component" cascade="none" column="ComponentID" access="field" />

<property name="_quantity" access="field" column="Quantity" />
<property name="_unit" access="field" column="UnitID" />

</class>

<class name="Supplier" table="Suppliers">

<id name="_id" column="ID" unsaved-value="0" access="field">
<generator class="identity" />
</id>

<property name="_code" column="Code" access="field"/>
<property name="_name" column="Name" access="field"/>
<property name="_contact" column="Contact" access="field"/>
<property name="_address" column="Address" access="field"/>
<property name="_telephone" column="Telephone" access="field"/>
<property name="_eMail" column="EMail" access="field"/>
<property name="_webSite" column="Website" access="field"/>
<property name="_comments" column="comments" access="field"/>
<property name="_myDiscount" column="MyDiscount" access="field"/>
<property name="_active" column="Active" access="field"/>

</class>

************************************************************************************************

My code:

Public Function GetActiveArticles() As IList

Dim session As ISession = Nothing

Try

session = _nhFactory.OpenSession

Return session.CreateCriteria(GetType(Article)). _
Add(Expression.Expression.Eq("_active", True)). _
AddOrder(Expression.Order.Asc("_name")).List

Catch ex As Exception

Throw New ApplicationException("Could not get articles.", ex)

Finally

If Not session Is Nothing Then _
session.Close()
End Try

End Function


Thank's in advance!!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 09, 2007 11:08 pm 
Regular
Regular

Joined: Wed Apr 25, 2007 11:44 pm
Posts: 59
hey man u corrupted the data

check the Article table and related data for the record # 249

hope that it works


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

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.