-->
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.  [ 3 posts ] 
Author Message
 Post subject: Inherited classes - property from parent class in HQL
PostPosted: Sat Aug 27, 2005 2:52 pm 
Newbie

Joined: Sat Aug 27, 2005 2:37 pm
Posts: 2
I have 2 classes:
Code:
@Inheritance(strategy = InheritanceType.JOINED)
class A {
  public String getName()
}

class B extends A {
}


How can I access property name in HQL for class B? I can't write only "name", because Hibernate searches for "name" only in class B. At least in following case:

I have third class C:
Code:
class C {

  @OneToMany()
  @OrderBy(...)
  public List getListB()
}


When I use @org.hibernate.annotations.OrderBy, it appends table name and dot before every column name - but column is in another table (becaouse of JOIN type of inheritance). So SQL statements results in error, because column with that name doesnt exists in table. When I use @javax.persistence.OrderBy, it search for property name only in class B - so Hibernate says me "property does not exists".

What is the right way to do this? Is there any way how to tell Hibernate that some property should be found in full class hierarchy, or at least within parent class?
Thanks.
I use Hibernate 3.1 beta1 with Annotations 3.1 beta4.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 5:18 am 
Newbie

Joined: Mon Nov 28, 2005 2:35 pm
Posts: 14
Hi!
I am having the same problem. Have you been able to solve it?

Thx


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 03, 2005 10:30 am 
Newbie

Joined: Sat Aug 27, 2005 2:37 pm
Posts: 2
foster wrote:
Hi!
I am having the same problem. Have you been able to solve it?
Thx


Only solution I found is using @Sort annotation, so Java (client-side) sort is used.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.