Hi,
I'm using Hibernate 2.1 final, Windows 2000, Jdk 1.3 and DB2 7.2. I am trying to do the following:
DocumentObject mapped to TBL.DOCUMENT (all properties)
MiniDocumentObject mapped to TBL.DOCUMENT (just some of the properties)
DocumentObject contains sets and large fields. MiniDocumentObject is read-only, and contains only "lightweight" fields. I want to search in several properties inside the DocumentObject, but put the result in a list of MiniDocumentObjects. Is this possible?
The reason I want to do this is performance: when I search for DocumentObjects in my web application, I want a list containing all properties in the MiniDocumentObject. When I click on one of the MiniDocumentObjects in the list, I want to load the full DocumentObject.
I can't figure out the HQL to use, and I don't know if this is even possible. Can anyone point me in the right direction?
Here's a subset of the hibernate mappings:
Code:
<hibernate-mapping auto-import="false">
  <class name="domain.Document" table="TBL.DOCUMENT">
    <id name="id" type="long" column="id">
      <generator class="increment"/>
    </id>
    <set name="notes" table="TBL.NOTE" inverse="true" cascade="all-delete-orphan">
      <key column="DOC_ID"/>
      <one-to-many class="domain.Note"/>
    </set>
  </class>
  <class name="domain.MiniDoc" table="TBL.DOC" mutable="false">
    <cache usage="read-only"/>
    <id name="id" type="long" column="id">
      <generator class="increment"/>
    </id>
</hibernate-mapping>
Thanks in advance!
Regards,
Ola
Code:
Code:
Code: