-->
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: Hierarchy mapping WrongClassException
PostPosted: Fri Aug 27, 2010 11:01 am 
Newbie

Joined: Mon Aug 31, 2009 1:19 pm
Posts: 11
Hello, I have two hierarchies A and B where SubB1 will be related with SubA1 and SubB2 with SubA2:

Code:
@Entity
public abstract class ClassA{(...)}
@Entity
public class SubA1(){(...)}
@Entity
public class SubA2(){(...)}


Code:
@Entity
public abstract class ClassB{
   (...)
   protected ClassA myA;
   
   @ManyToOne()
   @Foreign(name="B_A")
   public ClassA getMyA(){...}
   (...)
}

@Entity
public class SubB1{
   (...)
   @Transient
   public SubA1 getMyA(){
      return (SubA1)myA;
   }
   (...)   
}

@Entity
public class SubB2{
   (...)
   @Transient
   public SubA2 getMyA(){
      return (SubA2)myA;
   }
   (...)
}


When I create a B object and persist it it works correctly, the problem is when I load it back. Hibernate throws a org.hibernate.WrongClassException

Could any one help me??

Regards,
Chiara


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.