| Hibernate version: 3.2.4 
 Hi,
 
 I'm using the query cache with Ehcache and the JPA implementation.
 
 My request returns 3 elements from the database. Everything is fine.
 But when Hibernate tries to retrieve the objects from the query cache the list is composed of null objects,
 
 Here is the logs:
 
 DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection
 DEBUG org.springframework.jdbc.datasource.DriverManagerDataSource - Creating new JDBC Connection to [jdbc:oracle:thin:@psdev01:1522:IDTV3DU2]
 DEBUG org.hibernate.SQL - select * from ( select episodes1_.XID as XID0_, episodes1_.COMMENTS as COMMENTS0_, episodes1_.MAIN_CONTENT_ID as MAIN13_0_, episodes1_.PUBLIC_ID as PUBLIC4_0_, episodes1_.TITLE as TITLE0_, episodes1_.TYPE_SUBTYPE_LIST as TYPE6_0_, episodes1_.VERSION as VERSION0_, episodes1_.APPROX_DURATION as APPROX8_0_, episodes1_.SEASON_ID as SEASON11_0_, episodes1_.SEQ_NUMBER as SEQ9_0_, episodes1_.SEQ_NUMBER_DISPLAY as SEQ10_0_, episodes1_.CLASS as CLASS0_ from DT3_CON_CONTENT season0_ inner join DT3_CON_CONTENT episodes1_ on season0_.XID=episodes1_.SEASON_ID where season0_.CLASS='com.lysis.idtv3.content.adaptors.PSeason' and season0_.XID=? ) where rownum <= ?
 DEBUG org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
 DEBUG org.hibernate.loader.Loader - result row: EntityKey[com.lysis.idtv.model.VideoContent#38856]
 DEBUG org.hibernate.loader.Loader - result row: EntityKey[com.lysis.idtv.model.VideoContent#165666]
 DEBUG org.hibernate.loader.Loader - result row: EntityKey[com.lysis.idtv.model.VideoContent#165665]
 DEBUG org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
 DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
 DEBUG org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
 DEBUG org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
 DEBUG org.hibernate.engine.TwoPhaseLoad - resolving associations for [com.lysis.idtv.model.Production#38856]
 DEBUG org.hibernate.engine.TwoPhaseLoad - done materializing entity [com.lysis.idtv.model.Production#38856]
 DEBUG org.hibernate.engine.TwoPhaseLoad - resolving associations for [com.lysis.idtv.model.Production#165666]
 DEBUG org.hibernate.engine.TwoPhaseLoad - done materializing entity [com.lysis.idtv.model.Production#165666]
 DEBUG org.hibernate.engine.TwoPhaseLoad - resolving associations for [com.lysis.idtv.model.Production#165665]
 DEBUG org.hibernate.engine.TwoPhaseLoad - done materializing entity [com.lysis.idtv.model.Production#165665]
 DEBUG org.hibernate.engine.StatefulPersistenceContext - initializing non-lazy collections
 DEBUG org.hibernate.cache.StandardQueryCache - caching query results in region: org.hibernate.cache.StandardQueryCache; timestamp=4862990954733569
 DEBUG org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
 
 ....
 
 Great, I have my 3 objects:
 INFO com.XXX.service.impl.SeriesServiceImpl - results = [com.lysis.idtv.model.Production@1563e06, com.lysis.idtv.model.Production@10204ce, com.lysis.idtv.model.Production@1898b92]
 
 ....
 
 And then for the next calls:
 
 ...
 
 DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 4862990955245572
 DEBUG org.hibernate.cache.StandardQueryCache - checking cached query results in region: org.hibernate.cache.StandardQueryCache
 DEBUG net.sf.ehcache.hibernate.EhCache - key: sql: select episodes1_.XID as XID0_, episodes1_.COMMENTS as COMMENTS0_, episodes1_.MAIN_CONTENT_ID as MAIN13_0_, episodes1_.PUBLIC_ID as PUBLIC4_0_, episodes1_.TITLE as TITLE0_, episodes1_.TYPE_SUBTYPE_LIST as TYPE6_0_, episodes1_.VERSION as VERSION0_, episodes1_.APPROX_DURATION as APPROX8_0_, episodes1_.SEASON_ID as SEASON11_0_, episodes1_.SEQ_NUMBER as SEQ9_0_, episodes1_.SEQ_NUMBER_DISPLAY as SEQ10_0_, episodes1_.CLASS as CLASS0_ from DT3_CON_CONTENT season0_ inner join DT3_CON_CONTENT episodes1_ on season0_.XID=episodes1_.SEASON_ID where season0_.CLASS='com.lysis.idtv3.content.adaptors.PSeason' and season0_.XID=?; parameters: ; named parameters: {season=39092}; first row: 0; max rows: 3
 DEBUG org.hibernate.cache.StandardQueryCache - Checking query spaces for up-to-dateness: [DT3_CON_CONTENT]
 DEBUG net.sf.ehcache.hibernate.EhCache - key: DT3_CON_CONTENT
 DEBUG net.sf.ehcache.hibernate.EhCache - Element for DT3_CON_CONTENT is null
 DEBUG org.hibernate.cache.StandardQueryCache - returning cached query results
 DEBUG org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
 ...
 
 An now the values are null:
 INFO com.XXX.service.impl.SeriesServiceImpl - results = [null, null, null]
 
 
 
 Any ideas?
 Thanks in advance.
 J.
 
 
 |