second-level-cache

"Cached Item Was Locked" causing Select Statement in Hibernate

I am having trouble with getting some caching to work with hibernate exactly the way I would like. I created some example code to replicate this problem I am having. I have one object that contains instances of itself. For instance, a Part that is made up of more Parts. I really need to minimize the select statements that Hibernat...

NHibernate with fluent mapping and Syscache2 second level caching

I have a very simple Country entity which I want to cache. This works perfectly, but I want a clone version of the cached instance to be returned or be made read-only to prevent developers from changing the state of it. How would I achieve this? I tought that the Fluent Readonly() method would enforce this, but it's not the case. Sa...

Hibernate second-level cache in orm.xml?

Hello, Having been googling for hours, I realize that users can use either xml file(orm.xml, I suppose?) or annotations in JPA, or both of them at the same time. I'm i correct? So, My project use the second-level cache, which is not in the JPA specification. And I use annotations like: @org.hibernate.annotations.Cache(usage = org.hibern...

How I can disable the second-level cache of some certain entities in Hibernate without changing annotations

Hello, I'm using Hibernate second level cache in my application, for certain business reason I can't change the entity annotation any more. In my project, apart from changing the Database from Hibernate, there exist also other native SQL that do not go through Hibernate. Therefore, the Hibernate second-level cache data could be stale a...

Hibernate second-level cache ehcache.xml, the cache setting for entities can't be read to HIbernate

To make it clear and easy, I have two projects: 1. An Entity project where there are all the entity classes in this project. 2. An project that contains a main() function to run the application, My ehcache.xml is placed in the class path of this project. My problem is: I can change the defaultCache element of ehcache.xml and I can see c...

How to config QueryCache in ehcache.xml

From my sql log file, I think the QueryCache's physical properties are configured by the element: <defaultCache maxElementsInMemory="0" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="false" memoryStoreEvicti...

Hibernate Second level Cache <<net.sf.ehcache.hibernate.EhCacheProvider>>

Hi every one, I want use second level cache in my hibernate Project but I just know a little about hibernate second level cache, can any one explain how shoud I use this in my code and what configuration and .jar file I need? I set these setting to my hibernate.cfg.xml file <property name="hibernate.cache.use_query_cache">true</propert...

Hibernate: batch_size? Second Level Cache ?

I have a Hibernate domain object that gets loaded by different parts of the application. Sometimes it's advantageous to lazy load every association and others it's better to load the entire thing in one join. As a hopefully happy compromise I've found: Using batch fetching, Hibernate can load several uninitialized proxies if one proxy...

Hibernate L2 Cache on cluster

Q1: Am I right that only this vendors support Hibernate L2 cache on cluster? Terracotta for Hibernate (comercial) SwarmCache (not released since 2003) JBoss Cache 1.x JBoss Cache 2 Q2: Are there are any alternatives to Hibernate L2 cache? (Maybe some DB caching?) ...

Transactional L2 cache in Hibernate

Q1: What does "transactional" strategy guarantee? Q2: What is the difference between "transactional" strategy and "read/write" strategy with JTA as transaction manager (specified by property). Q3: What if I specify "transaction" strategy for some entity in a .hbm.xml file and then will use L2 cache which does not support "transaction"...

Transactional strategy for Hibernate L2 Cache

If Hibernate L2 cache vendor supports "transactional" strategy, then does it mean that this cache guarantees the same level of isolation between transactions as specified in Hibernate config? For example, if cache supports "read-write" strategy then it guarantees REPEATABLE_READ isolation level (and in some cases only READ_COMMITTED lev...

Hibernate 2nd level cache not caching committed entities

I'm wondering if it's possible for Hibernate second level cache (we're using EHCache) to allow an application to cache an Entity that has been comitted to the DB if it knows that no other applications are modifying the DB. My thought is that if I update record A, then I know the value of record A and should be able to cache that, JVM cl...

JBossCache as a second level cache for Hibernate in JBoss 5

Here is my configuration: Hibernate 3.3.1.GA, JBoss 5.1.0.GA, JBoss Cache 3.2.0.GA. I'm doing Hibernate configuration as described here: http://www.jboss.org/community/wiki/ClusteredJPAHibernateSecondLevelCachinginJBossAS5 <hibernate-configuration> <session-factory> <property name="cache.use_second_level_cache">true</pro...

Hibernate: Clean collection's 2nd level cache while cascade delete items

I have a problem Hibernate does not update 2nd level cache for a collection of items which are subject of cascade removal. Details Assume we have an object Parent which has Parent.myChildren collection of Child objects. Now we have also object Humans with Humans.myAllHumans collection and all Parent and Child objects are in that collec...

NHibernate query cache and WCF

I've enabled query cache for one of my queries, it works fine (query result is taken from query cache and entities from second level cache) when I run a test or a console application. However, if I run the same queries through a WCF service, the cache is never hit. I've also checked the logs in both cases and they are practically ident...

Hibernate 2nd level cache invalidation when another process modifies the database

We have an application that uses Hibernate's 2nd level caching to avoid database hits. I was wondering if there is some easy way to invalidate the Java application's Hibernate 2nd level cache when an outside process such as a MySQL administrator directly connected to modify the database (update/insert/delete). We are using EHCache as...

SharedCache vs Memcached For NHibernate With ASP.NET MVC

Hi, Which shared cache provider should i use for my asp.net mvc working with NHibernate ? ShardCache NHibernate Provider Memcached NHibernate Provider Thanks. ...

NHibernate named query and 2nd level cache

Hi all, I have the following mapping <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Domain.Core" namespace="Domain.Core"> <class name="Industry" table="INDUSTRY"> <cache usage="read-write" region="IndustryCache" include="all"/> <id name="Id" type="In...

Manage NHibernate second level cache

I just started thinking about using the NHibernate second level cache in one of my apps. I would probably use the NHibernate.Caches.SysCache.SysCacheProvider which relies on ASP.net cache. Enabling the cache was not a problem, but I am wondering on how to manage the cache e. g. programmatically removing certain entities from the cache e...

hibernate cache strategy

how to decide whitch CacheConcurrencyStrategy to use? NonstrictReadWriteCache, ReadOnlyCache, ReadWriteCache, TransactionalCache . I read https://www.hibernate.org/hib%5Fdocs/v3/api/org/hibernate/cache/CacheConcurrencyStrategy.html but doesn't explain in detail enough ...