Hibernate version:2.2
i have the following mapping file
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Tatweer.TietLibrary.Trading" assembly="TietLibrary">
<class name="Instrument" table="tiet_instruments">
<composite-id>
<key-property name="Isin" />
<key-property name="Symbol" />
<key-property name="SecurityExchangeId" />
</composite-id>
<property name="Isin" column="isin">
<column name="isin" sql-type="char(12)" not-null="true" />
</property>
<property name="Symbol" column="symbol">
<column name="symbol" sql-type="varchar(16)" not-null="true" />
</property>
<property name="Currency" column="currency">
<column name="currency" sql-type="varchar(8)" not-null="true" />
</property>
<property name="Name" column="name">
<column name="name" sql-type="text" not-null="false" />
</property>
<property name="SecurityExchangeId" column="marketId">
<column name="marketId" sql-type="integer" not-null="false" />
</property>
</class>
</hibernate-mapping>
now i try to find an entry by isin and marketid
Code:
NHibernate.ICriteria c = session.CreateCriteria(typeof(Instrument));
c.Add(NHibernate.Expression.Expression.Eq("Isin", "xxx"));
c.Add(NHibernate.Expression.Expression.Eq("SecurityExchangeId", "1"));
and it dies:
Code:
0x0001: Kernel: Error starting strategy 'eur_usd.cur': 'Tatweer.TietLibrary.Database.AccessException: Error getting item
s. ---> NHibernate.ADOException: could not execute query
[ SELECT this_.Isin as Isin1_0_, this_.Symbol as Symbol1_0_, this_.SecurityExchangeId as Security3_1_0_, this_.isin as i
sin1_0_, this_.symbol as symbol1_0_, this_.currency as currency1_0_, this_.name as name1_0_, this_.marketId as marketId1
_0_ FROM tiet_instruments this_ WHERE this_.Isin = ? and this_.SecurityExchangeId = ? ]
Positional parameters: 0 xxx
0 1
[SQL: SELECT this_.Isin as Isin1_0_, this_.Symbol as Symbol1_0_, this_.SecurityExchangeId as Security3_1_0_, this_.isin
as isin1_0_, this_.symbol as symbol1_0_, this_.currency as currency1_0_, this_.name as name1_0_, this_.marketId as marke
tId1_0_ FROM tiet_instruments this_ WHERE this_.Isin = ? and this_.SecurityExchangeId = ?] ---> MySql.Data.MySqlClient.M
ySqlException: Unknown column 'this_.SecurityExchangeId' in 'field list'
looks to them that it is not translating the property "Isin" to "isin" and "SecurityExchangeId" to "marketId"
so it tried
Code:
c.Add(NHibernate.Expression.Expression.Eq("isin", "xxx"));
c.Add(NHibernate.Expression.Expression.Eq("marketId", "1"));
but
Code:
0x0001: Kernel: Error starting strategy 'eur_usd.cur': 'Tatweer.TietLibrary.Database.AccessException: Error getting item
s. ---> NHibernate.QueryException: could not resolve property: isin of: Tatweer.TietLibrary.Trading.Instrument
bei NHibernate.Persister.Entity.AbstractPropertyMapping.ThrowPropertyException(String propertyName) in C:\Dokumente u
nd Einstellungen\Sascha.Kiefer\Desktop\NHibernate-1.2.0.GA-src\src\NHibernate\Persister\Entity\AbstractPropertyMapping.c
s:Zeile 29.
now it does not find the property "isin"
any ideas?