Hibernate version: 1.2
Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="SubClassProblem.Animal, SubClassProblem" table="[Animal]" lazy="true" polymorphism="implicit">
<id name="Key" column="[Key]">
<generator class="native" />
</id>
<property name="Name" column="[Name]" type="System.String"/>
<joined-subclass name="SubClassProblem.Dog, SubClassProblem" table="[Dog]" lazy="true">
<key column="[Key]"/>
<property name="TailLength" column="[TailLength]" type="System.Int32"/>
</joined-subclass>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
IQuery query = session.CreateQuery("select o.Key from Animal o where o.class = SubClassProblem.Dog");
Full stack trace of any exception that occurs:
Name and version of the database you are using:
MS SQLServer 2005
The generated SQL (show_sql=true):
select animal0_.[Key] as x0_0_ from [Animal] animal0_ where (case when animal0_1_.[Key] is not null then 1 when animal0_.[Key] is not null then 0 end=1
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html