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!