-->
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: table-per-concrete-class inheritance mapping and getting the
PostPosted: Wed Mar 16, 2005 12:33 am 
Newbie

Joined: Tue Mar 15, 2005 11:57 pm
Posts: 4
Hello Hibernate guys,

"SecParaDetailed" is a superclass of many classes I used as a table in my hibernate mapping. I used table-per-concrete-class inheritance mapping strategy because I do not want to create a table for "SecParaDetailed".

How do I query all its subclasses together with the "class property? Should I use "discriminator-value" instead to be able to query its "class property"? I need to query the "class property" because I want to distinguish one subclass from the other.

Right now, I'm getting "cannot get class property" error when I use the following query:

session.find("select detailed.class from SecParaDetailed detailed");


Hope you can shed light to me regarding this matter.

Thanks in advance! :)

_________________
Hibernate rocks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 16, 2005 12:51 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
Do all of your subclasses extend SecParaDetailed? (or implement a common interface)

Can you execute this query and get all subclass instances: "from SecParaDetailed"

This should just be a simple case of implicit polymorphism: http://www.hibernate.org/hib_docs/v3/reference/en/html/inheritance.html#d0e6941


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 17, 2005 2:04 am 
Newbie

Joined: Tue Mar 15, 2005 11:57 pm
Posts: 4

1. Do all of your subclasses extend SecParaDetailed? (or implement a common interface)



Yah! All of my subclasses extends "SecParaDetailed". Do you have any solution on how can I able to distinguish one subclass from the rest? I'm thinking of using the "class property" but it gives me errors I've mentioned above.


2. Can you execute this query and get all subclass instances: "from SecParaDetailed"


Yah! It returns all the fields from all the tables(in which I use these subclasses in creating them). Now, my problem is how can I able to know which fields belonging from which table.

Thanks for the reply! :)[/b]

_________________
Hibernate rocks!


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.