-->
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: Help needed with sql-query and a polymorphic collection
PostPosted: Sat Dec 09, 2006 12:38 pm 
Newbie

Joined: Fri Dec 08, 2006 11:48 am
Posts: 6
Hibernate version: 3.2.1
Name and version of the database you are using: HSQLDB 1.8.0.7

After reading the manual, I'm struggling to map a sql-query for a polymorphic collection

This example is quite close to what I'm trying to do. Lets say I have a class File with subclasses:

Class File
-> Class Directory
-> Class RegularFile
-> Class Socket

Code:
<union-subclass name="Directory">
    <list name="files" table="directory_files">
        <key column="directory_id"/>
        <list-index column="sort_order"/>
        <many-to-many column="file" class="File"/>
        <loader query-ref="get_files"/>
    </list>
</union-subclass>


But for my query, I'm stuck on how to do this. So far, I have

Code:
<sql-query>
    <return alias="allfiles" class="File"/>
    <return-join alias="dirfiles" property="allfiles.files"/>

    QUERY WITH LEFT OUTER JOIN AND UNIONS GOES HERE
</sql-query>


But this doesn't work as it complains that property allfiles.files isn't a property of File. Is it possible to even do this? The reason I have to define a custom query is so that I can work around a SQL bug in HSQLDB.

Any insight would be much appreciated!


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.