-->
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: NHibernate.UnresolvableObjectException:
PostPosted: Thu Jul 27, 2006 10:23 am 
Newbie

Joined: Wed Jul 19, 2006 8:44 am
Posts: 1
hi,


i am getting the following expcepton due to non availability of some records in serviceExpense table , but what i need if the records does not match then it should left join and bring null values instead, inspite of using outer-join= true, fetch=join and not-null=false for the many-to-one relationship for Service and Expense property it throws this error.

could some body help me out, how can i make a outer join for this association

Hibernate version: 1.0.2.0

Mapping documents:


InvoiceDetail :

<class name="CoreServices.Invoicedetail, CoreServices" table="invoicedetail">
<id name="Id" column="id_Id" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<property column="id_serviceCode" type="Int32" name="IdServiceCode" />
<many-to-one name="Service" class="CoreServices.Serviceexpense, CoreServices" column="id_serviceCode" update="false" insert="false"/>
<property column="id_expenseCode" type="Int32" name="IdExpenseCode" />
<many-to-one name="Expense" class="CoreServices.Serviceexpense, CoreServices" column="id_expenseCode" update="false" insert="false"/> ...

</class>

Serviceexpense :

<class name="CoreServices.Serviceexpense, CoreServices" table="serviceexpense">
<id name="SeCode" column="se_code" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<property column="se_description" type="String" name="SeDescription" />
<property column="se_disbursementCode" type="String" name="SeDisbursementCode" />
<property column="se_hotkey" type="String" name="SeHotkey" />
<property column="se_lfOrgId" type="Int32" name="SeLfOrgId" />
<property column="se_phaseCode" type="String" name="SePhaseCode" />
<property column="se_taskCode" type="String" name="SeTaskCode" />
<property column="se_type" type="String" name="SeType" />
</class>






ISession session = NHibernateHelper.GetCurrentSession();

string hql = "from Invoiceheader ih where ih.IhLfOrgId=" + orgId;

if(!invStatus.Equals(""))
{
hql += " and ih.IhStatus='" + invStatus + "'";
}

if(faId != 0)
{
hql += " and ih.Vendor.FaId=" + faId;
}

if(ptfmInvNo != 0)
{
hql += " and ih.IhFirmInvoiceNo=" + ptfmInvNo;
}

if(!vendorInvNo.Equals(""))
{
hql += " and ih.IhFaInvoiceNo='" + vendorInvNo + "'";
}

if(!clientNo.Equals(""))
{
hql += " and ih.Client.CoClientNumber='" + clientNo + "'";
}

if(!matterNo.Equals(""))
{
hql += " and ih.Matter.MaMatterNo='" + matterNo + "'";
}

hql += " order by ih.IhFirmInvoiceNo Desc";

IQuery query = session.CreateQuery(hql);


query.SetMaxResults(2000);
//query.SetFirstResult(currentPage*recordsPerPage).SetMaxResults(recordsPerPage);
IList results = query.List();

//NHibernateHelper.CloseSession();

return results;





NHibernate.UnresolvableObjectException: No row with the given identifier exists: 0, of class: CoreServices.Serviceexpense

Server stack trace:
at NHibernate.Impl.SessionImpl.InternalLoad(Type clazz, Object id)
at NHibernate.Type.ManyToOneType.ResolveIdentifier(Object id, ISessionImplementor session)
at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session, Object owner)
at NHibernate.Impl.SessionImpl.InitializeEntity(Object obj)
at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.OneToManyLoader.Initialize(Object id, ISessionImplementor session)
at NHibernate.Collection.AbstractCollectionPersister.Initialize(Object key, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.InitializeCollection(PersistentCollection collection, Boolean writing)
at NHibernate.Collection.PersistentCollection.ForceInitialization()
at NHibernate.NHibernateUtil.Initialize(Object proxy)
at Ayende.NHibernateQueryAnalyzer.ProjectLoader.HqlResultGraph.InitializeCollections(Object obj)
at Ayende.NHibernateQueryAnalyzer.ProjectLoader.HqlResultGraph.get_RemoteGraph()
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Ayende.NHibernateQueryAnalyzer.ProjectLoader.HqlResultGraph.get_RemoteGraph()
at Ayende.NHibernateQueryAnalyzer.Model.Project.RunHql(String hql, TypedParameter[] parameters)
at Ayende.NHibernateQueryAnalyzer.UserInterface.Commands.ExecuteQueryCommand.Execute()






database :
MYSQL 5.0.19 -nt



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.