Showing posts with label Java Frameworks. Show all posts
Showing posts with label Java Frameworks. Show all posts

Friday, March 11, 2011

Hibernate Cache

Hibernate is a well-know persistence framework in the  Java world, it comes with a wonderful API to ease application communication with the database. Caching is a mechanism that stores data so that future requests for that data can be served faster. It’s a good point for performance when there are a lot of requests for the same stuff . 


Hibernate comes with 3 caching mechanisms to resolve this issue.
First Level Cache
A hibernate session is a unit of work that’s corresponding to a DB transaction. When doing operations on entities, these latters are not stored immediately in DB but wait until the session commits. The hibernate session is hence representing the first level cache and it’s enabled by default.
Second Level Cache
A hibernate SessionFactory aims to create sessions, initializes JDBC connections and pool them. The second level cache lives in the SessionFactory level so all session can share it. This is why it’s called a process scoped cache.
The second level cache is not enabled by default. One has to configure the cache strategy for hibernate entities and the cache provider that will be a third party caching API like EHCache.
Query Cache
This is related to second level cache and is used for caching queries with parameters. It has to be configured like the second level cache.
To know if the application is hitting the cache, you can configure it in the session factory configuration file and begin your unit tests to get an idea of performance.

Tuesday, November 04, 2008

How pretty it is - Click

http://click.sourceforge.net/

Click is a open source simple JEE web application framework for commercial Java developers, licensed under the Apache license.Click uses an event based programming model for processing Servlet requests and Velocity for rendering the response. (Note other template engines such as JSP and Freemarker are also supported).

It is really a pretty good framework to develop website and easy to learn also.

Get to know Apache Click.
http://www.ibm.com/developerworks/web/library/wa-apacheclick/?ca=dgr-jw22ApacheClick&S_TACT=105AGX59&S_CMP=grjw22