-->
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: Cannot recognize sub-class properties in a query
PostPosted: Thu Mar 16, 2006 5:32 am 
Newbie

Joined: Mon Oct 24, 2005 8:18 am
Posts: 6
I have a structure like this:

Code:
@Entity
public class User {
   Person person;
   //...
}

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class Person {...}

@Entity
public class Student extends Person {
   SomeType someStudentProperty;
   //...
}

@Entity
public class Teacher extends Person {...}   

I want to query the users with testing the someStudentProperty in the where clause, but it doesn't work...
"from User u where u.person.someStudentProperty = whatsoever..."

("from User u where u.person.somePersonProperty = whatsoever..." works correctly)

Is it a bug, I miss something, or it is not a supported feature?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 17, 2006 9:30 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Think of what are you trying to do?
How should it know that your person from User is a Student?

Code:
select u from User u, Student s where s.someSP = :sp and u.person = s


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.