-->
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 caching problem
PostPosted: Fri Nov 03, 2006 3:15 pm 
Newbie

Joined: Fri Nov 03, 2006 2:51 pm
Posts: 1
Location: SPb, Russia
Seems that criteria.list() return exactly the same results for different parameters when caching enabled in some cases:
Repeatable call of this code with different parameter return exactly same results:
Code:

Criteria criteria = session.createCriteria(Operation.class);
criteria.setCacheable(true).setRegion("getFiltered#"+Operation.class.getName());
criteria.add(Restrictions.eq("doctype", doctype));
List r = criteria.list();

where doctype - instance of ObjectType:
Code:
@Entity
@Table(name = "OBJECT_TYPES", uniqueConstraints = {@UniqueConstraint(columnNames = {"name"})})
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region = "ObjectType")
public class ObjectType implements Serializable{
  @Id
  @GeneratedValue
  protected Long id;
  ....
}


It's work fine when caching disabled:
Code:

Criteria criteria = session.createCriteria(Operation.class);
criteria.add(Restrictions.eq("doctype", doctype));
List r = criteria.list();


Also, after many attempts, i found workaround for this:
Code:

Criteria criteria = session.createCriteria(Operation.class);
criteria.setCacheable(true).setRegion("getFiltered#"+Operation.class.getName());
criteria.add(Restrictions.eq("doctype.id", doctype.getId()));
List r = criteria.list();


Is it bug? Or some my lack of understanding?

Hibernate version:
hibernate 3.2.0.cr1
hibernate-annotation 3.1beta9
EHCache or JBoss TreeCache with OptimisticTreeCacheProvider

Stacktrace:
no stacke traces/silent

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


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.