Hibernate 3.0 / MySQL 4.1
Mapping:
<class name = "Something" table = "things" discriminator-value= "X">
<id name = "id"><generator class = "native"/></id>
<discriminator column = "type" type="character"/>
<subclass name = "com.stuff.ThingA" discriminator-value = "A"/>
<subclass name = "com.stuff.ThingB" discriminator-value = "B"/>
JavaCode:
DetachedCriteria dc = DetachedCriteria.forClass(com.stuff.ThingA.class)
.setProjection( Property.forName( "id"));
Criteria c = getCriteria( Rating.class, "rating")
.add( Subqueries.propertyIn("rating.id", dc) )
SQL code: select [...] where this_.id in (select this0__.id as y0_ from things this0__) ....
Seem there is something missing like "type='A'" in the generated SQL code, which should refer to the given class in "DetachedCriteria.forClass( com.stuff.ThingA.class)".
Am I wrong here or is this a bug?
regards, Axel
|