-->
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.  [ 2 posts ] 
Author Message
 Post subject: Table per hierarchy not identifying subclasses
PostPosted: Thu Oct 07, 2010 6:15 pm 
Newbie

Joined: Thu Oct 07, 2010 6:05 pm
Posts: 2
I am mapping a table using "table-per-hierarchy". When I search by the ID, I am able to get one subclass(SubA) loaded correctly, but get a WrongClassException when trying to load a object which should be loaded to the 2nd subclass(SubB). Below is the hibernate mapping(having removed additional properties) and exception stack. Not sure if this matters but the mappings for individual classes are in separate files.

From the exception it looks like its trying to load Product object instead of SubB, although, it has identified the discriminator correctly as ABC.

With this mapping when I search for a products SubA is found correctly, but I SubB doesnt get picked up correctly with WrongClassException.


Last edited by sgk205 on Fri Oct 08, 2010 1:58 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Table per hierarchy not identifying subclasses
PostPosted: Fri Oct 08, 2010 9:45 am 
Newbie

Joined: Thu Oct 07, 2010 6:05 pm
Posts: 2
Folks,

I was able to find a workaround. The column in the table for discriminator is defined as char(4). I changed the discriminator for SubB from ABC to ABCD and it works.

Is this a known limitation when using discriminators? Is this a know limitation when using char(4) instead of say varchar or int?

Would be great to have a confirmation if this indeed is a limitation.


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

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.