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.  [ 4 posts ] 
Author Message
 Post subject: Could not find a getter for property...
PostPosted: Tue Aug 28, 2007 3:17 pm 
Newbie

Joined: Tue Aug 28, 2007 2:22 pm
Posts: 7
Error: Could not find a getter for property 'id_operacion' in class 'OperCapacMantenedoresApp.Operacion'

Hola!

He buscado en la documentación pero no he encontrado la solución. Creo que tengo todos los archivos bien definidos.
Operacion.hbm.xml y hibernate.cfg.xml tienen Build Action = "Embedded Resource".

¡Muchas gracias por sus sugerencias y comentarios!

NHibernate version: 1.2
Mapping documents:

Code:
hibernate.cfg.xml

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="OperCapacMantenedoresAppConfiguration">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.connection_string">server=srv;database=desarrollo;uid=sa;pwd=**</property>
<property name="show_sql">true</property>
<mapping assembly="OperCapacMantenedoresApp"/>
</session-factory>
</hibernate-configuration>

Code:
Operacion.hbm.xml

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="OperCapacMantenedoresApp" namespace="OperCapacMantenedoresApp">
<class name="Operacion" table="[desarrollo].[dbo].[OperCapac_Operaciones]">
<id name="id_operacion" column="id_operacion" type="int">
<generator class="assigned"/>
</id>
<property name="d_operacion" column="operacion" type="string"/>
</class>
</hibernate-mapping>

Code:
Operacion.cs

using...
namespace OperCapacMantenedoresApp {
public class Operacion {

private int id_operacion;
private string d_operacion;

public Operacion() { }

public virtual int Id_operacion {
get { return id_operacion; }
set { id_operacion = value; }
}

public virtual string D_Operacion {
get { return d_operacion; }
set { d_operacion = value; }
}

}
}


Full stack trace of any exception that occurs:
Could not find a getter for property 'id_operacion' in class 'OperCapacMantenedoresApp.Operacion'

at NHibernate.Property.BasicPropertyAccessor.GetGetter(Type type, String propertyName) at NHibernate.Tuple.PropertyFactory.GetGetter(Property mappingProperty) at NHibernate.Tuple.PropertyFactory.BuildIdentifierProperty(PersistentClass mappedEntity, IIdentifierGenerator generator) at NHibernate.Tuple.EntityMetamodel..ctor(PersistentClass persistentClass, ISessionFactoryImplementor sessionFactory) at NHibernate.Persister.Entity.AbstractEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory) at NHibernate.Persister.Entity.SingleTableEntityPersister..ctor(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping) at NHibernate.Persister.PersisterFactory.CreateClassPersister(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg) at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings) at NHibernate.Cfg.Configuration.BuildSessionFactory() at OperCapacMantenedoresApp.ManOperaciones.Configuracion() in C:\Programas\NET\OperCapacDesktopApp\OperCapacMantenedoresApp\OperCapacMantenedoresApp\ManOperaciones.cs:line 40

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

(Pudieran estar relacionados:
http://jira.nhibernate.org/browse/NH-251
http://jira.nhibernate.org/browse/NH-134 )


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 28, 2007 3:57 pm 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
Change your mapping to be
Code:
<id name="Id_operacion" column="id_operacion" type="int">

Property names are case sensitive and you had a lowercase 'i'.
Mike

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 28, 2007 4:18 pm 
Newbie

Joined: Tue Aug 28, 2007 2:22 pm
Posts: 7
mnichols wrote:
Change your mapping to be
Code:
<id name="Id_operacion" column="id_operacion" type="int">

Property names are case sensitive and you had a lowercase 'i'.
Mike


thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 28, 2007 4:59 pm 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
No problem.
Another alternative is to specify access='field'

Good luck
Mike

_________________
If this helped...please remember to rate it!


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