1 Reply Latest reply on Sep 10, 2008 11:45 AM by mircea.markus

    Does the log show my entities are loaded from cache?

    zlf

       

      2008-09-10 15:57:31,546 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 5001353017532416
      2008-09-10 15:57:31,546 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking for a JTA transaction to join
      2008-09-10 15:57:31,546 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
      2008-09-10 15:57:31,546 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking for a JTA transaction to join
      2008-09-10 15:57:31,546 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Transaction already joined
      2008-09-10 15:57:31,546 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
      2008-09-10 15:57:31,546 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
      2008-09-10 15:57:33,281 DEBUG [org.hibernate.SQL] /* select s from ContestStatus s */ select conteststa0_.contest_detailed_status_id as contest1_10_, conteststa0_.contest_detailed_status_desc as contest2_10_, conteststa0_.name as name10_, conteststa0_.contest_status_id as contest4_10_ from contest_detailed_status_lu conteststa0_
      2008-09-10 15:57:33,281 INFO [STDOUT] Hibernate: /* select s from ContestStatus s */ select conteststa0_.contest_detailed_status_id as contest1_10_, conteststa0_.contest_detailed_status_desc as contest2_10_, conteststa0_.name as name10_, conteststa0_.contest_status_id as contest4_10_ from contest_detailed_status_lu conteststa0_
      2008-09-10 15:57:34,250 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
      2008-09-10 15:57:34,250 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.mycompany.ContestStatus#6]
      2008-09-10 15:57:34,250 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.mycompany.ContestStatus#1]
      2008-09-10 15:57:34,250 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.mycompany.ContestStatus#2]
      2008-09-10 15:57:34,250 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.mycompany.ContestStatus#3]
      2008-09-10 15:57:34,250 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.mycompany.ContestStatus#4]
      2008-09-10 15:57:34,250 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.mycompany.ContestStatus#5]
      2008-09-10 15:57:34,250 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.mycompany.ContestStatus#7]
      2008-09-10 15:57:34,250 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.mycompany.ContestStatus#8]
      2008-09-10 15:57:34,562 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
      2008-09-10 15:57:34,921 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.mycompany.ContestStatus#6]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [com.mycompany.ContestStatus#6]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.mycompany.ContestStatus#1]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [com.mycompany.ContestStatus#1]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.mycompany.ContestStatus#2]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [com.mycompany.ContestStatus#2]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.mycompany.ContestStatus#3]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [com.mycompany.ContestStatus#3]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.mycompany.ContestStatus#4]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [com.mycompany.ContestStatus#4]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.mycompany.ContestStatus#5]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [com.mycompany.ContestStatus#5]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.mycompany.ContestStatus#7]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [com.mycompany.ContestStatus#7]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.mycompany.ContestStatus#8]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [com.mycompany.ContestStatus#8]
      2008-09-10 15:57:35,234 DEBUG [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections


      My ehcache configuration is
      <ehcache>
      <diskStore path="c:\cache"/>

      <defaultCache
      maxElementsInMemory="10000"
      eternal="true"
      timeToIdleSeconds="1020"
      timeToLiveSeconds="1020"
      overflowToDisk="true"
      />
      <cache name="com.mycompany.Contest.ContestStatus"
      maxElementsInMemory="10000"
      eternal="true"
      timeToIdleSeconds="3000"
      timeToLiveSeconds="6000"
      overflowToDisk="true"
      />


      I call "select * from ContestStatus" twice, the log is from the second time calling. From the log, I guess ContestStatus entities are not retrieved from cache, loaded from another sql queries. But cannot figure out what is the problem.