Hibernate version:
Hibernate 3.0
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class
name="it.publisys.finanziaria.modello.BeanFondi"
table="FONDI"
>
<id
name="fnId"
type="java.lang.Integer"
column="FNID">
<generator class="assigned"/>
</id>
........
........
<set name="fondiE" lazy="true" inverse="true" >
<key column="FNDFONDIID"/>
<one-to-many class="it.publisys.finanziaria.modello.BeanFondiE"/>
</set>
<set name="fondiU" lazy="true" inverse="true" >
<key column="FNDFONDIID"/>
<one-to-many class="it.publisys.finanziaria.modello.BeanFondiU"/>
</set>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class
name="it.publisys.finanziaria.modello.BeanFondiEU"
table="FONDID">
<id
name="fnEUId"
type="java.lang.Integer"
column="FNDID">
<generator class="assigned"/>
</id>
<discriminator
type="java.lang.String"
column="FNDTIPO"
not-null="true"
length="1"/>
<property
name="fnEUAnno"
type="java.lang.Integer"
column="FNDANNO"
not-null="true"
length="4"
/>
<many-to-one name="beanFondi"
column="FNDFONDIID"
class="it.publisys.finanziaria.modello.BeanFondi"
cascade="none"
outer-join="true"
not-null="true" >
</many-to-one>
<subclass
name="it.publisys.finanziaria.modello.BeanFondiE"
discriminator-value="E">
</subclass>
<subclass
name="it.publisys.finanziaria.modello.BeanFondiU"
discriminator-value="U">
</subclass>
</class>
</hibernate-mapping>
When i instert or update a object into beanFondiE or beanFondiU
it works fine and if i see generated sql, the value of the descriminator assigned is correct and takes the value 'E' or 'U'.
But if want all the object BeanFondiE from BeanFondi it doesn't work and the generated sql is:
Hibernate: select fondie0_.FNDFONDIID as FNDFONDIID__,
..........
from FONDID fondie0_
....
where fondie0_.FNDFONDIID=?
and it doesn't use the descriminator. Why?
|