[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1134?page=c...
]
HG commented on HHH-1134:
-------------------------
Well force="true" will solve the issue, but not if you use second level cache.
While fetching the entity from a cache hibernate does not care if the force is true or
not, simply because of the fact that discriminator information is not present in the
CacheKey used by hibernate.
What can we do to have to have the same behaviour as "force='true'" with
second level cache :( ???
subclass tag with discriminator in one to many mapping
------------------------------------------------------
Key: HHH-1134
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1134
Project: Hibernate Core
Issue Type: Bug
Components: core
Environment: hibernate 3.0.5, Oracle
Reporter: Dilip Ranjith
Consider the following hbm.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
>
<class
name="DCDTO"
table="ACCDC"
dynamic-update="true"
>
<id
name="ID"
type="java.lang.String"
>
<column
name="DCINFOID"
/>
<generator class="sequence">
<param name="sequence">DSEQ</param>
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-DebtorCreditorDTO.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<discriminator
column="accountType"
not-null="true"
type="java.lang.String"
force="true"
insert="true"
/>
<property
name="creditMax"
type="java.lang.Double"
update="true"
insert="true"
column="creditMax"
/>
<subclass
name="CDTO"
dynamic-update="true"
dynamic-insert="true"
discriminator-value="C"
>
</.subclass>
<subclass
name="DDTO"
dynamic-update="true"
dynamic-insert="true"
discriminator-value="D"
>
</.subclass>
</class>
</hibernate-mapping>
DCDTO is the super class while DDTO and CDTO are its child classes
If in a mapped object say TDTO there are a set of CDTOs and a separate set of DDTOs
when we get TDTO the where clause "where accountType='D' " is not
there when the query for set of DDTOs are generated. so instead of a set of DDTOs i am
getting a set of both DDTO's and CDTO's
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira