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: ActiveSession.Load does not throw ObjectNotFoundException
PostPosted: Wed Sep 12, 2007 11:52 am 
Beginner
Beginner

Joined: Wed May 31, 2006 9:24 am
Posts: 22
hi there, I am having a problem I haven't encountered before - I am loading an object thus:

return ActiveSession.Load(typeof(Profile), id);

Previously when I did this, if the id did not exist, I got an ObjectNotFoundException. However, now the same code is returning an empty instance of the proxy class, which as soon as my code accessess any methods / properties of the object I get the ObjectNotFoundException.

I don't understand why this has changed since I haven't updated my NHibernate dll or any of my session management code etc. Can anyone understand why the load call would not throw the ObjectNotFoundException?

Regards, Ben

Mapping document:
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Domain.Classes" assembly="Domain" default-access="field.camelcase">
<class name="Profile" table="`Profile`">
<id name="Id" column="ProfileId" type="Int32" unsaved-value="0">
<generator class="identity" />
</id>

<property name="Name" column="Name" type="String" not-null="true" />
<property name="PrimaryKeywords" column="PrimaryKeywords" type="String" not-null="false" />
<property name="SecondaryKeywords" column="SecondaryKeywords" type="String" not-null="false" />
<property name="Filename" column="Filename" type="String" not-null="false" />
<property name="PageHeading" column="PageHeading" type="String" not-null="false" />
<property name="Description" column="Description" type="String" not-null="false" />
<property name="SubHead1" column="SubHead1" type="String" not-null="false" />
<property name="SubHead2" column="SubHead2" type="String" not-null="false" />
<property name="Text1" column="Text1" type="String" not-null="false" />
<property name="Text2" column="Text2" type="String" not-null="false" />
<property name="Image1FileName" column="Image1FileName" type="String" not-null="false" />
<property name="Image2FileName" column="Image2FileName" type="String" not-null="false" />
<property name="SiteURL" column="SiteURL" type="String" not-null="false" />
<property name="SiteURLDesc" column="SiteURLDesc" type="String" not-null="false" />
<property name="Published" column="Published" type="Boolean" not-null="true" />
<property name="Image1Alt" column="Image1Alt" type="String" not-null="false" />
<property name="Image2Alt" column="Image2Alt" type="String" not-null="false" />
<property name="CreatedBy" column="CreatedBy" type="Int32" not-null="true" />
<property name="CreatedDate" column="CreatedDate" type="DateTime" not-null="true" />
<property name="LastChangedBy" column="LastChangedBy" type="Int32" not-null="true" />
<property name="LastChangedDate" column="LastChangedDate" type="DateTime" not-null="true" />
<list name="Categories" table="ProfileCategories" lazy="true" cascade="all">
<key column="ProfileId" />
<index column="Rank" type="Int32" />
<many-to-many class="Category" column="CategoryId"/>
</list>
<bag name="ProfileViews" inverse="true" lazy="true" order-by="ProfileViewId" cascade="all-delete-orphan">
<key column="ProfileId" />
<one-to-many class="ProfileView" />
</bag>
<many-to-one name="Account" column="AccountId" class="Account" not-null="true"/>

</class>
</hibernate-mapping>


Hibernate version:
1.2.0.4000

Name and version of the database you are using:
SQL Server 2005


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.