Hi all,

I'm hoping someone can point me in the right direction. I'm using the Lightweight Class design pattern and I cannot seem to get polymorphism="explicit" working as expected.

I have an Info and Gene object, and when I try to do this:

Info info = (Info)session.load(Info.class, "PA267");
Gene gene = (Gene)session.load(Gene.class, "PA267");

The second line throws a ClassCaseException, because it's returning a GeneInfo object rather than a Gene object. It works fine if I reverse the order of the two load calls.


The only difference between what I'm doing and the example at http://hibernate.bluemars.net/41.html is that my Gene class is a joined-subclass. My mapping file looks something like:


 <class name="Info" table="Data" mutable="false">
   <property name="name" />
   <property name="symbol" column="symbol" />
 </class>

 <class name="Data" table="Data" polymorphism="explicit">
   <property name="name" />
   <property name="symbol" />

   <joined-subclass name="Gene" table="Genes">
     <property name="cytogeneticLocation" />
   </joined-subclass>

   <joined-subclass name="Subclass2" table="Subclass2">
     <property name="data2" />
   </joined-subclass>

   <joined-subclass name="Subclass3" table="Subclass3">
     <property name="data3" />
   </joined-subclass>
 </class>

Anyone have any idea what my problem is?

Thanks,
-Mark




------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to