-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: entity SINGLE_TABLE lazy=true ClassCastException
PostPosted: Thu Mar 15, 2007 12:41 pm 
Newbie

Joined: Tue Aug 02, 2005 11:41 am
Posts: 1
Hibernate 3.2

Parent class:

@Entity
@Table(name="message")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="MESSAGE_CLASS",
discriminatorType=DiscriminatorType.INTEGER
)
public abstract class Message {...


Subclass:

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("1")
public class StructuredLetter extends Message {...

When I run the following code I get a java.lang.ClassCastException: com.gudrun.gdp3000.business.messagecenter.domain.Message$$EnhancerByCGLIB$$8c8c7d71

StructuredLetter letter = (StructuredLetter) messageDAO.get(id);

This is logical because this Hibernate-cglib class is put in between because of lazy loading.
But how can I get my StructuredLetter?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.