-->
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: Echache not affecting List request
PostPosted: Mon Jan 17, 2005 8:28 pm 
Regular
Regular

Joined: Fri Oct 08, 2004 4:11 am
Posts: 78
Location: Nottingham, England
Hi,
I have specified that my maps utilise Echaching, which they do very nicely. But I have noticed while looking in the logs that the database is hit everytime a request is made to return a list (shown in the code below). How can I Echache the result of a List request so that the database is not hit everytime?

regards

Uzo

Hibernate version:
Code:
Jboss 4.0.0


Mapping documents:
Code:
   <class name="Artist" table="artisttbl">
      <cache usage="read-write"/>
      <id name="ID" column="artist_id">
         <generator class="assigned"/>
      </id>
      <version name="Version" column="version" type="integer"/>
      <property name="ArtistName" column="artist_name" type="string" not-null="true"/>
      <property name="ArtistInfo" column="artist_info" type="string" not-null="true"/>
      <property name="TrackLocation" column="track_location" type="string"/>
      <property name="TrackInfo" column="track_info" type="string"/>
      <property name="StockID" column="stock_id" type="string"/>
      <set name="ArtistImages" inverse="true" lazy="true" cascade="all-delete-orphan">
         <cache usage="read-write"/>
         <key column="artist_id"/>
         <one-to-many class="ArtistImages"/>   
        </set>
   </class>


Return List:
Making a request this way does not chache the result.
Code:
   
          //Get Artist details
          query = session.createQuery("from test.Artist");
          artists = query.list();
         


Return Map:
Making a request this way chaches the result.
Code:
   
          //Get Artist details
          artist = (Artist)session.load(Artist.class, artist_id);
         


Name and version of the database you are using:
Code:
PostgreSQL 8.0


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.