-->
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: Mapping two objects to the same table, and queries
PostPosted: Wed Dec 17, 2003 8:35 am 
Newbie

Joined: Tue Dec 16, 2003 9:57 am
Posts: 13
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:


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.