I can't see what's wrong...
I've got this: a Localidad (City) has a property Provincia (State), and a Provincia has a collection of Localidad. the mappings are as follows:
Provincia (State)
Code:
<class name="ReglasPrestamos.Provincia, ReglasPrestamos" table="Provincia">
<id name="Id" type="Int32" unsaved-value="0">
<column name="id" />
<generator class="native" />
</id>
<many-to-one name="Pais" class="ReglasPrestamos.Pais, ReglasPrestamos" fetch="select">
<column name="id_pais" not-null="true" />
</many-to-one>
<property name="Nombre" type="String">
<column name="nombre" not-null="true" />
</property>
<set name="Localidades" inverse="true">
<key>
<column name="id_provincia" not-null="true" />
</key>
<one-to-many class="ReglasPrestamos.Localidad, ReglasPrestamos" />
</set>
</class>
Localidad (City)
Code:
<class name="ReglasPrestamos.Localidad, ReglasPrestamos" table="Localidad">
<id name="Id" type="Int32" unsaved-value="0">
<column name="id" />
<generator class="native" />
</id>
<many-to-one name="Provincia" class="ReglasPrestamos.Provincia, ReglasPrestamos" fetch="select">
<column name="id_provincia" not-null="true" />
</many-to-one>
<property name="Nombre" type="String">
<column name="nombre" not-null="true" />
</property>
</class>
if I make a Criteria Query
Code:
ICriteria auxCriteria = session.CreateCriteria(typeof(T)) //Generics
auxCriteria.Add(NHibernate.Expression.Expression.Like("Nombre", //City's name
"%ros%"));
auxCriteria.Add(NHibernate.Expression.Expression.Like("Provincia.Nombre", //State.Name
"%sa%"));
when it tryes to add "Provincia.Nombre" it throws the exception
Quote:
could not resolve property:Provincia.Nombre of :Localidad
this exception is thrown by the class AbstractPropertyMapping and method string[] ToColumns( string alias, string propertyName )
so... can anyone find the problem?