second-level-cache

config ehcache.xml for jpa entity or use annotation?

when using ehcache rather than defining statement like <cache name="testonly.package.model.TestPOJOcategory" maxElementsInMemory="200" eternal="true" overflowToDisk="false" timeToIdleSeconds="300" timeToLiveSeconds="600" /> can directly define inside entity independent of whatever cache pro...

Hibernate 2nd level cache objects that are lazy=false, result in a default fetch=join, is it documented anywhere?

I experience the following apparently undocumented issue, and I want to understand if I did something wrong Did anyone encounter the same issue? Is it really not documented anywhere? or did I miss something? The behavior is this Assume the following mapping <class name="org.sample.Foo" table="foo"> ... <many-to-one name="bar...

Hibernate query cache - for objects not in the 2nd level cache - risky? usefull? bad practice?

Related to this question Premise: These are my assumptions, based on my reading, experience and understanding, they may be wrong, if they are, please comment and I'll edit the question. Query cache is good mostly along with 2nd level cache Query cache caches the identifiers results of queries + parameters Query cache is risky if the...

Does Hibernate 2nd-Level cache invalidate when running a JPQL update statement

When you run a JPQL update or delete query, is Hibernate smart enough to invalidate the 2nd-level cache for the entity that is changed? Contrived example: You have the JPQL: update Product p set p.status = 'S' where p.name like 'Monitor%' If you currently have products in the 2nd-level cache when that statement is run, will Hibernat...

CPU-Core thread classification Function

I'm going to be writing a multi-threaded shared memory messaging system for ultra high-volume message delivery between processes. The messages will originate from the worker threads of a web-server. I'd like to exploit the CPU cache locality that cores on the same CPU share. So that when I wake up a worker thread on the receiving end of ...

SwarmCache Hibernate configuration

Could anyone hint me how to configure SwarmCache for Hibernate to work in cluster (distributed cache)? Probably there are some other alternatives (please, don't suggest JBoss Cache)? ...

Hibernate - query caching/second level cache does not work by value object containing subitems

Hi! I have been struggling with the following problem: I have a value object containing different panels. Each panel has a list of fields. Mapping: <class name="com.aviseurope.core.application.RACountryPanels" table="CTRY" schema="DBDEV1A" where="PEARL_CTRY='Y'" lazy="join"> <cache usage="read-only"/> <id name="ctryCode"> <column name...

NHibernate 2nd Level Cache and Joined Subclass

I'm having a problem where an entity mapped as a joined subclass is cached on insert, and the cache does not get updated when I perform an update on this entity. Should the NHibernate 2nd level cache be updated when an update is performed on a joined subclass? I'm using the SysCacheProvider, and the class is mapped with a <cache usage...

NHibernate + ASP.NET + Open Session in View + L2Cache

I am using CodeProject's well known Open Session in View to handle NHibernate Sessions. Does it works well with Level 2 Cache? Anyone has succeeded doing it? Should I use NH.Burrow instead? Any advice on l2 cache in asp.net best practices is appreciated. Edit: link to CodeProject's article: http://www.codeproject.com/KB/architecture/NHi...

How to temporarily disable read-only 2nd level cache hibernate strategy in Grails ?

In my grails application, some of my domain classes will never be changed by Users. However, some maintenance work is sometimes necessary, and administrator should be able to create/edit few instances from time to time (let's say twice a year). I would like to set a read-only 2nd level cache strategy for these domain classes (static ma...

Questions about caching in high-traffic website.

Suppose we are building an E-commerce site that allows consumers to search for products by typing in keywords. Say there are at most 200,000 products, and there are millions of consumers using the system. Let’s say the product table is updated fairly frequently. Since the number of products is not that high and we can probably store the ...

How to use second level cache for lazy loaded collections in Hibernate?

Let's say I have two entities, Employee and Skill. Every employee has a set of skills. Now when I load the skills lazily through the Employee instances the cache is not used for skills in different instances of Employee. Let's Consider the following data set. Employee - 1 : Java, PHP Employee - 2 : Java, PHP When I load Employee - ...

NHibernate 2nd level cache provider for NHibernate 2.1.1.4000

I am using s#arp which is built against NHibernate 2.1.1.4000, However I would like to use NHibernate.Caches.SysCache as my second level cache. However the Nhibernate contrib caches are built against NHibernate 2.1.2.4000 which obviously gives me a problem. Can anyone point me to a URL that I can download NHibernate.Caches.SysCache.dll ...

Using ASP.NET Caching on top of NHibernate 2nd Level Caching

Should i consider using ASP.NET Caching to cache query results on top of NHibernate 2nd Level Caching to improve performances ? ...

How to know/log whether Hibernate 2nd-level cache was used or not for a query?

Hi, Currently, in order to check if the Hibernate 2nd-level cache was used for a Database query, I check my SQL log (through p6spy or logSql=true in Datasource.groovy) to see if the Grais/Hibernate triggered an SQL query. And I assume that if the query was not logged, it might mean that cache was used. It is pretty complicated for a ...

NHibernate Caching Dilemma

My application includes a client, web tier (load balanced), application tier (load balanced), and database tier. The web tier exposes services to clients, and forwards calls onto the application tier. The application tier then executes queries against the database (using NHibernate) and returns the results. Data is mostly read, but writ...

Which second level cache to select for nHibernate?

I have a Data Service created using WCF that internally uses nHibernate. This WCF Data Service is used by Asp.Net application from Web Server. To improve the performance of the nHibernate Data service I want to implement nHibernate second leve cache. Which second level cache provider will be good in this scenerio? As the SysCache uses As...

Is it worth migrating to NHibernate 2.x from NHibernate 1.2?

We are using nHibernate 1.2 in a system which is not performing good. Will there be some performance improvement if we migrate to latest version of nHibernate? Overall is it a good idea to migrate to the latest version of nHibernate? EDIT: I want to use following features to improve performance. 1. Second level cache. 2. Joined Tab...

NHibernate 2nd lvl cache, custom query, sqldialect

I got trunk version of NH and FNH. When i try to add 2nd level cache, some parts of NHibernate forgets about chosen sqldialect. Initial configuration: var cfg = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008 .ConnectionString(connectionString) .DefaultSchema("dbo") .UseReflectionOptimizer() .Mappings(...

How to clear the entire second level cache in NHibernate

I wish to clear the entire second level cache in NHibernate via code. Is there a way to do this which is independent of the cache provider being used? (we have customers using both memcache and syscache within the same application). We wish to clear the entire cache because changes external the database would have occurred (which we ha...