-->
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.  [ 3 posts ] 
Author Message
 Post subject: bug on NHibernate.Util.ReflectHelper.GetGetter
PostPosted: Wed Jun 01, 2005 7:05 am 
Newbie

Joined: Mon May 16, 2005 5:58 am
Posts: 11
Location: Galicia, Spain
I have a property mapped like this:
Code:
   [Serializable]
   public enum EstadosNecesidadMaterial {cancelada, modificada, cubierta, pendiente};

   [Serializable]
   [Persistent]
   public class NecesidadMaterial: BOBase
   {
...
      [Persistent]
      public virtual EstadosNecesidadMaterial Estado
      {
         get
         {
                                                     ....
         }
      }
....
   }



<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-access="field">
  <class name="Einsa.Nautilus.BOL.NecesidadMaterial, Einsa.Nautilus.BOL" table="NecesidadMaterial" lazy="false">
    <jcs-cache usage="read-write" />
    <id name="idNecesidadMaterial" column="idNecesidadMaterial" type="Guid" unsaved-value="{00000000-0000-0000-0000-000000000000}">
      <generator class="guid" />
    </id>
....

<property name="Estado" column="Estado" access="Einsa.Nautilus.DAL.ReadOnlyPropertyAccessor, Einsa.Nautilus.DAL" />

...
  </class>
</hibernate-mapping>


when NHibernate try to find the type of Estado by refection, not found this type and then the next code:

Code:
try
         {
            // first try the named strategy since that will be the most likely strategy used.
            accessor = ( IPropertyAccessor ) PropertyAccessorFactory.PropertyAccessors[ propertyAccessorName ];
            return accessor.GetGetter( theClass, propertyName );
         }
         catch( PropertyNotFoundException )
         {
....
}



fails

PropertyAccessorFactory.PropertyAccessors[ propertyAccessorName ] don't have the type and then return null => accessor = null

Then accessor.GetGetter throw an exception diferently PropertyNotFoundException

this exception isn't capture by another method => assembly fail.

I think that if change PropertyNotFoundException by Exception the problem is solve, but there isn


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 11:58 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
I don't understand what is the goal of "ReadOnlyPropertyAccessor" :?

Anyway, we should add a catch for Exception (as this code shows).

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 02, 2005 3:48 am 
Newbie

Joined: Mon May 16, 2005 5:58 am
Posts: 11
Location: Galicia, Spain
ReadOnlyPropertyAccessor is like access="nosetter" but without field. It's a calculated field.
if you want we could post the source code of that class

thanks


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