-->
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.  [ 8 posts ] 
Author Message
 Post subject: not-found attribute
PostPosted: Fri Oct 27, 2006 10:06 am 
Regular
Regular

Joined: Thu May 11, 2006 12:30 pm
Posts: 72
i set the attribute not-found='ignore' in a many-to-one element, but at runtime i'm getting an exception

"No row with the given identifier exists

Hibernate version: 1.2.0 beta1

Mapping documents:
<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.0'>
<class name='CUP.ReservationDetail, CUP' table='RIGHEPRENOTAZIONI' lazy='false'>
<composite-id>
<key-property name='Year' column='PREANN' />
<key-property name='Number' column='PRENUM' />
<key-property name='DetailRow' column='PRERIG' />
</composite-id>
<version name='Version' column='PRERVE' unsaved-value='0' />
<property name='Document' column='PRERIC' />
<property name='ReservationDate' column='PREDAT' />
<many-to-one class='CUP.ExamDescription, CUP' name='ExamInfo' column='PREARKEY' insert ='false' update='false'/>
<many-to-one class='CUP.Availability, CUP' name='Availability' insert ='false' update='false' not-found='ignore' not-null='false'>
<column name='PRESPKEY'/>
<column name='PREDIACOD'/>
<column name='PRETPRCOD'/>
<column name='PREDAT'/>
<column name='PREORA'/>
<column name='PREMIN'/>
</many-to-one>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

IList<ReservationDetail> details = this.m_session.CreateCriteria(typeof(ReservationDetail)).Add(new EqExpression("Year", int.Parse(dgvPatients.SelectedRows[0].Cells[3].Value.ToString()))).Add(new EqExpression("Number", int.Parse(dgvPatients.SelectedRows[0].Cells[4].Value.ToString()))).List<ReservationDetail>();

Full stack trace of any exception that occurs:

in NHibernate.UnresolvableObjectException.ThrowIfNull(Object o, Object id, Type clazz) in C:\Documents and Settings\luke\Documenti\Riferimenti VS2005\NHibernate\NHibernate\UnresolvableObjectException.cs:riga 59

Name and version of the database you are using: Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 10:25 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Quote:
Full stack trace of any exception that occurs:

in NHibernate.UnresolvableObjectException.ThrowIfNull(Object o, Object id, Type clazz) in C:\Documents and Settings\luke\Documenti\Riferimenti VS2005\NHibernate\NHibernate\UnresolvableObjectException.cs:riga 59


Doesn't look exactly like full stack trace to me...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 10:34 am 
Contributor
Contributor

Joined: Tue May 30, 2006 1:25 am
Posts: 29
Ciao Luca...

Today a have no time to test the mapping.
Tomorrow i think i can make a test using "insert=false update=false" together with not-found="ignore".

Are you secure that the problem is in Availability property and not in ExamInfo ?

Can you make a separatelly test of your class ? (N.B. a UnitTest without grid view and so on)

_________________
Fabio Maulo.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 10:39 am 
Contributor
Contributor

Joined: Tue May 30, 2006 1:25 am
Posts: 29
Ops...
You are using comositeID..
Can you send the mapping of Availability too ?

Any way is better if you create a separate UnitTest.

_________________
Fabio Maulo.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 10:53 am 
Regular
Regular

Joined: Thu May 11, 2006 12:30 pm
Posts: 72
hey guy this is visual studio debug output (see the attach!)

Image

fabiomaulo, the exception say that CUP.Availability was not found, so i think the problem is there ;-)

this is Availability mapping file

Code:
<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.0'>
  <class name='CUP.Availability,CUP' table='DISPONIBILITA' lazy='false'>
    <composite-id>
      <key-property name='MainCategoryID' column='SPKEY' />
      <key-property name='DiagnosticID' column='DIACOD' />
      <key-property name='PerformanceTypeID' column='TPRCOD' />
      <key-property name='AvailabilityDate' column='DISDAT' />
      <key-property name='Hour' column='DISORA' />
      <key-property name='Minute' column='DISMIN' />
    </composite-id>
    <property name='AvailabilityType' column='DISTIP' />
    <property name='FreeAvailability' column='DISPPF' />
    <property name='BusyAvailability' column='DISPPR' />
    <property name='ForceAvailability' column='DISFRZ' />
    <property name='Note' column='DISNOT' />
    <many-to-one class ='CUP.MainCategory, CUP' name ='MainCategory' insert ='false' update='false' column ='SPKEY' />
    <many-to-one class ='CUP.Diagnostic, CUP' name ='Diagnostic' insert ='false' update='false'>
      <column name ='SPKEY'/>
      <column name ='DIACOD'/>
    </many-to-one>
    <many-to-one class ='CUP.PerformanceType, CUP' name ='PerformanceType' insert ='false' update='false'>
      <column name ='SPKEY'/>
      <column name ='DIACOD'/>
      <column name ='TPRCOD'/>
    </many-to-one>
  </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 11:23 am 
Contributor
Contributor

Joined: Tue May 30, 2006 1:25 am
Posts: 29
Please create a JIRA attaching 2 simple class and it's mapping with composite ID.

Ciao Luca, domani dovrei avere tempo di guardarci.
Bye Luca, tomorrow may I have time to look inside.

Fabio.

P.S. a my friend would say: compositeId, session in front-end, dbGrid column to fetch objs... look like "spaghetti code" ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 11:49 am 
Regular
Regular

Joined: Thu May 11, 2006 12:30 pm
Posts: 72
Quote:
P.S. a my friend would say: compositeId, session in front-end, dbGrid column to fetch objs... look like "spaghetti code" ;)


what does it means ?

compositeId : i'm using untouchable oracle schema, so i need to use those definitions;
session in front-end : i've only front-end, and i need a single session so...
dbGrid column to fetch objs : i'm not using dbgrid to fetch objects ??

and last but not least : i'm Italian and i love spaghetti with every sauces ;-)[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 7:54 pm 
Contributor
Contributor

Joined: Tue May 30, 2006 1:25 am
Posts: 29
Luca.. i'm italian too.
create a JIRA and tomorrow i'm go to get a look.

_________________
Fabio Maulo.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.