-->
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: Criteria API avoid selecting blob columns
PostPosted: Wed Oct 15, 2008 12:56 pm 
Newbie

Joined: Wed Oct 15, 2008 12:50 pm
Posts: 1
Hi guys, I'm running into a criteria issue. Maybe you can shine some light for me? :)

I will attach the mapping files of two domain objs. Activity and UploadedClaim. On UploadedClaim, Activity is mapped as a one-to-one relationship.

Because the UploadedClaim has two blob fields, querying those fields really slow down the performance. I'm trying to avoid selecting those fields during a search. So I tried using Projections.


Hibernate version: 3.2.2

Name and version of the database you are using: Oracle 10g

Mapping documents:

Activity:

Code:
<class name="com.rainhail.claim.eadjuster.core.domain.Activity"
         table="common.activity" >
   
      <id name="activityId" column="activity_id" type="java.lang.Long">
         <generator class="sequence">
            <param name="sequence">common.activity_seq</param>
         </generator>
      </id>

      <many-to-one name="activityType" column="activity_type_id"
         not-null="true" />

      <property name="activityDate" column="activity_date"
         type="java.util.Date" not-null="true" />
         
      <property name="division" column="division"
         type="java.lang.Integer" not-null="true" />
         
      <property name="policySymbol" column="policy_symbol"
         type="string" not-null="true" />
      
      <property name="policyNumber" column="policy_number"
         type="java.lang.Integer" not-null="true" />
      
      <property name="claimNumber" column="claim_number"
         type="java.lang.Integer" not-null="true" />
      
      <property name="webUserProfileId" column="id"
            type="java.lang.Integer" not-null="true" />
      
   </class>


UploadedClaim:
Code:
<class name="com.rainhail.claim.eadjuster.core.domain.UploadedClaim"
         table="common.upload_claim">
   
      <id name="uploadedClaimId" column="activity_id" type="java.lang.Long">
         <generator class="foreign">
            <param name="property">activity</param>
         </generator>
      </id>

      <one-to-one name="activity" constrained="true" lazy="false" />
      <many-to-one name="uploadStatus" column="status_id" not-null="true" />

      <property name="document" column="document"
         type="com.rainhail.claim.eadjuster.core.dao.hibernate.BlobUserType"
         not-null="false" length="4000000" />
         
      <property name="xmlDocument" column="document_xml"
         type="com.rainhail.claim.eadjuster.core.dao.hibernate.BlobUserType"
         not-null="false" length="4000000" />
         
      <property name="processedDate" column="processed_date"
         type="java.util.Date" />
      
      <property name="processedBy" column="processed_by" type="string" />
      
   </class>



Code between sessionFactory.openSession() and session.close():

Code:
Criteria pageC = session.createCriteria(UploadedClaim.class);
ProjectionList projList = Projections.projectionList();
projList.add(Projections.property("uploadedClaimId"));
projList.add(Projections.property("activity"));
projList.add(Projections.property("uploadStatus"));
pageC.setProjection(projList);


Then pageC.list() returns a list of Object Array but the second parameter in the object array for activity is always null even though they exist in the db. I know it probably has something to do with the mapping.

I don't know if there is a way around this? I really do not want to abandon using Criteria since we have to perform search based on the uploadStatus and will need the properties on the activity obj to populate the search results.

Thanks


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.