[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-922) subclass tag with discriminator

Steve Ebersole (JIRA) noreply at atlassian.com
Mon Mar 21 13:00:23 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-922.
------------------------------


Closing stale resolved issues

> subclass tag with discriminator
> -------------------------------
>
>                 Key: HHH-922
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-922
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>         Environment: Hibernate 3,Oracle,Windows
>            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 
> suppose we do 
> session.get(DDTO.class, ID);
> the clause " where accountType='D'  "   is not happening
> as a result if the ID provided is the Pkey of CDTO entry (accountType='C')  it still gives the result 
> But if we execute the HQL query----"from DDTO where ID=?" the where clause (" where accountType='D'  " ) gets added!!!

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list