From: Sanjiv J. (JIRA) <no...@at...> - 2006-07-06 17:58:59
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1134?page=comments#action_23556 ] Sanjiv Jivan commented on HHH-1134: ----------------------------------- Here's another example with a more detailed description of the problem http://forum.hibernate.org/viewtopic.php?t=935374 > subclass tag with discriminator in one to many mapping > ------------------------------------------------------ > > Key: HHH-1134 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1134 > Project: Hibernate3 > 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.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |