Hi!
I have a simple mapping of my class
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly ="NHDomainLib" >
<class name="NHDomainLib.Class1, NHDomainLib" table="Class1" where ="Flag=100">
<id name="Id" column="Id" unsaved-value="-1">
<generator class="native" />
</id>
<property name="Name" column="Name" length ="32"></property>
<property name="Flag" column="Flag" length ="32" insert="false" update="false"></property>
</class>
</hibernate-mapping>
in mapping included WHERE attribute.
But when i try to get instance of Class1 from DB,
Code:
ISession session= SessFactory.OpenSession();
Class1 c1= session.Load(typef(Class1),5);
value of WHERE attribute in mapping of Class1 -
Flag=100 not used in resuted SQLstring.
SQL Profiler return sql string like that:
Code:
exec sp_executesql '
SELECT class10_.Id as Id0_,
class10_.Flag as Flag0_,
class10_.Name as Name0_,
FROM Class1 class10_
WHERE class10_.Id = @p0 ', N'@p0 int', @p0 = 5
in where clause i see only filter by priomary key but not a value of WHERE attribute.