-->
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.  [ 5 posts ] 
Author Message
 Post subject: polymorphic queries
PostPosted: Wed Jul 19, 2006 8:51 am 
Newbie

Joined: Wed Jul 19, 2006 8:03 am
Posts: 4
Location: Melbourne, Australia
Hi,

This may sound trivial and it probably is, but I'm having problems accessing data belonging to subclasses when querying an abstract class.

For example, if I do:

session.createCriteria( ContentVO.class ).list();

It returns instances of ContentVO and its subclasses. So I save a vector of ContentVOs like this from the resultset:

ContentVOSet conVOSet = new ContentVOSet();
...
ContentVO conVO =
(ContentVO) resultset.get(i);

conVOSet.addContent( conVO );

I can access all the data for ContentVO, however if I have let's say LinkVO as the subclass then how do I access it? Do I need to reformulate my query or is there any way I can get access to the subclass?

Thanks.


Mapping documents:

<hibernate-mapping package...>

<class name="ContentVO" table="content_table"
dynamic-update="true" optimistic-lock="version">
...

<joined-subclass name="LinkVO" table="link_table">
<key column="link_id"/>
<property name="contentIDFK" column="content_id_fk" not-null="true"/>
</joined-subclass>

</class>
</hibernate-mapping package>


Hibernate version: 3.1

Name and version of the database you are using:
MYSQL 4.1


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 20, 2006 1:16 am 
Newbie

Joined: Wed Jul 19, 2006 8:03 am
Posts: 4
Location: Melbourne, Australia
Sorry to be impatient, but would anyone have any clues about the problem above?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 20, 2006 2:50 pm 
Newbie

Joined: Wed Jul 19, 2006 8:03 am
Posts: 4
Location: Melbourne, Australia
I'm probably going to annoy quite a bit of people by bring this post up front, but can anyone please tell what am I missing here?

I am just clueless at this point :(


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 20, 2006 2:51 pm 
Newbie

Joined: Wed Jul 19, 2006 8:03 am
Posts: 4
Location: Melbourne, Australia
I'm probably going to annoy quite a bit of people by bring this post up front, but can anyone please tell what am I missing here?

I am just clueless at this point :(


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 20, 2006 6:23 pm 
Newbie

Joined: Wed Jul 19, 2006 9:46 am
Posts: 5
For a Discussion and Strategies of the Inheritance Mapping look into :

http://www.hibernate.org/hib_docs/v3/reference/en/html/inheritance.html

Maybe that helps.
Christoph


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