Give me simple example of hibernate caching and explain the
details of caching????? thanks in adv.



Give me simple example of hibernate caching and explain the details of caching????? thanks in adv...

Answer / imambasha

caching concept in hibernate is performed internally in
stages...
1)firstlevel(Session) caching
2)Secondlevel(SessionFactory) caching
1)firstlevel(Session) caching:
First-level cache always Associates with the Session
object. Hibernate uses this cache by default. Here, it
processes one transaction after another one, means wont
process one transaction many times. Mainly it reduces the
number of SQL queries it needs to generate within a given
transaction. That is instead of updating after every
modification done in the transaction, it updates the
transaction only at the end of the transaction.

2)Secondlevel(SessionFactory) caching
Second-level cache always associates with the Session
Factory object. While running the transactions, in between
it loads the objects at the Session Factory level, so that
those objects will available to the entire application,
don’t bounds to single user. Since the objects are already
loaded in the cache, whenever an object is returned by the
query, at that time no need to go for a database
transaction. In this way the second level cache works.

Is This Answer Correct ?    11 Yes 2 No

Post New Answer

More Advanced Java Interview Questions

What happens when we invoke a thread?s interrupt method while it is in sleeping or waiting condition?

1 Answers  


How many JSP scripting elements and what are they?

4 Answers   TCS,


iam writing the contents to a excel through I/O i am putting first statement as WRITE and then READ(from excel) immediately..later user complains that he is not getting the date by using READ ..wat could be the situation

3 Answers   iGate,


What method is invoked to cause an object to begin executing as a separate thread?

0 Answers  


Difference between sleep and suspend?

3 Answers  






What are the ways to define classes that can be run as threads?

1 Answers   KPIT,


what is Activation Instantinator?

0 Answers  


whats is mean by filter?

1 Answers   SolutionNET,


whats is statement and procedure

0 Answers   TCS,


diff mvc1 and mvc2 wahts is mean by servlet chaining?

1 Answers   SolutionNET,


If your ui seems to freeze periodically, what might be a likely reason?

0 Answers  


life cycle of an applet?

3 Answers  


Categories