-->
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: Performing a query against an abstract class...
PostPosted: Tue Mar 20, 2007 8:11 am 
Newbie

Joined: Tue Mar 20, 2007 7:51 am
Posts: 3
Hi,

I'm wondering if what I'm trying to do is meant to work or not, and if not, what the best approach is.

The basic situation is as follows:
    An abstract class (Call this C)
    Two concrete classes (A and B)
      Classes A and B map to separate tables in the DB (tblA and tblB)
      Both A and B have a property x which maps to columns tblA.y and tblB.z (i.e. same property name mapped to different columns)


Now is it possible to create a query as follows:
Code:
session.createCriteria(C.class)
    .add(Restrictions.like("x", "value"))
    .list();

Whereby the result will return me a list of concrete classes (A and B) where their x property matches "value".

Hopefully that makes sense as to what I'm trying to achieve.

Is this the correct approach?

Many thanks
Paul


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.