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: Hibernate EHCache-cached NamedQuery returns list w. null val
PostPosted: Fri Dec 23, 2011 9:11 am 
Newbie

Joined: Fri Dec 23, 2011 8:41 am
Posts: 1
I've got the following problem on Hibernate 3.5.6 with EHcache 2.5.0: I have this named query:

@NamedQuery(name = "User.findUserRolesByUserName", query = "select distinct u.roles from User u where u.numeUtilizator = :userName",
hints = {@QueryHint(name="org.hibernate.cacheable", value="true")
})

When it executes the first time the query.list() method the results are ok (coming from the database) but when subsequently it takes them from the cache, the list has null values. I looked into Hibernate code and i found that when it calls QueryLoader.list(SessionImplementor, QueryParameters, Set, Type[]) it passes a Type[] that contains one entry of type SetType. Further on, at StandardQueryCache.put(), the result parameter is correct - it contains a list of elements of type Rol (the expected type of the query results) - but still the Type[] parameter containing a SetType, when it gets to the
cacheable.add( returnTypes[0].disassemble( result.get( i ), session, null ) );
line, it calls the CollectionType (parent class) disassemble() method that returns null because the third parameter is null.

The Rol entity is annotated as follows:
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "USR_ROLURI")

Could someone please tell me what is the problem?
Many thanks,
Simon


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.