Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0.2
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="com.myadbox.bo">
<class name="User" table="df_user" dynamic-update="true">
<cache usage="read-write"/>
<id
column="user_id"
name="Id"
type="java.lang.Long"
>
<generator class="identity" />
</id>
<property
column="username"
length="25"
name="Username"
not-null="false"
type="string"
/>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="com.myadbox.bo">
<joined-subclass name="MessageBoxOwner"
table="message_box_owner"
extends="com.myadbox.bo.User">
<key column="message_box_owner_id" />
<many-to-one
name="MessageBox"
class="MessageBox"
column="message_box_id"
not-null="true"
/>
</joined-subclass>
</hibernate-mapping>
I recive a ClassCastException when trying to perform the following operation on an object which I *know* to be a MessageBoxOwner. In fact, if I examine the class with Eclipse at runtime, I can see that it has a MessageBox associated with it. Could somebody tell me how I could perform the following operation?
MessageBox mb = ((MessageBoxOwner) user).getMessageBox();
Without receiving the following error?
java.lang.ClassCastException: com.myadbox.bo.User$$EnhancerByCGLIB$$46f9c9d
Thank you very much for your time.