-->
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: Problem using Session.get()
PostPosted: Thu Jun 03, 2004 4:10 am 
Newbie

Joined: Thu Jun 03, 2004 3:57 am
Posts: 1
I have a class A and 3 subclasses of A (B, C and D) persistent in the same table. Only the classes C and D implements a Interface Intf.
At a certain point in my application I get a primary key of a entity which is a Implementation of Intf (dont know if is it a entity of type C or D). So I try to use as first lookup Session.get(C.class, thePrimKey) and as second lookup Session.get(D.class, thePrimKey) if the first lookup return null. But unfortunately it seems get() try to fetch the data of the database row in a instance of type C ignoring the ignoring the discriminator value of the row. I get a PropertyAccessException when Hibernate try to fill a property on type C which not exists on type D. When I try first a lookup with Session.get(D.class, thePrimKey) and it's a primary key of a C type entity I receive a WrongClassException (?). Why it's a different exception now?

I expected that get() return null if there is no entity for the given key and type?

I there a fix or workaround for it? How can I find the requested entity of type C or D which implements Intf ?

Thank you very much


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 2:42 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Use a find and put it to JIRA, I'm interested in Gavin answer on that. Thk

_________________
Emmanuel


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.