Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6845835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:32:58+00:00 2026-05-27T00:32:58+00:00

i specified the below properties in cfg file. <property name=hibernate.cache.use_second_level_cache>true</property> <property name=hibernate.cache.provider_class> net.sf.ehcache.hibernate.EhCacheProvider</property> In

  • 0

i specified the below properties in cfg file.

<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">
     net.sf.ehcache.hibernate.EhCacheProvider</property>

In my main1 program i create the person with id 1 and commited and made that thread on hold after commit. Then i start the another thread T2 which is getting ther person with id 1 with below code

person = (Person)session. get(Person.class,1);

when T2 passed above statement, it generate the below query in background

Hibernate: select person0_.id as id0_1_, person0_.cname as cname0_1_ from     MyProject1.Person person0_ where person0_.id=?

I am not sure why thread T2 reading from database instead of getting it from second level cache? as i am using usage as read-write

My Mapping looks like

<class name="com.daasl.Person"    >
<cache usage="read-write"/> 
  <id name="id" type="int">
     <generator class="increment"/>
  </id>
  <property name="name" column="cname" type="string"/>
 </class>  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:32:59+00:00Added an answer on May 27, 2026 at 12:32 am

    Got the issue.Actually each main programm has its own jvm instance, hence its own session factory.So second level cache wont work here. I tried the same thing in the same main programe once session is closed after creating the person in it. Then open new session and tried to get the same person, it got it from second level cache.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a mapping as like below: <hibernate-mapping auto-import=true default-lazy=false> <class name=com.saman.entity.hibernate.EmployeeEntity table=Employee optimistic-lock=version>
the link specified below is a jquery timer plugin. http://keith-wood.name/countdown.html Also i use the
<profile> <properties> <add name=Name allowAnonymous=true /> <add name=Age allowAnonymous=true type=System.Int16/> </properties> <providers> <add name=AspNetSqlProfileProvider
In the js code specified below - var tclass = function(){ this.func2=function(){console.log('func2')}; this.b={ func1:
I have a NSString object having multiple conditions specified in it like below: NSString
I want to add the tbody below: <tbody id=contact> ... </tbody> to a specified
In ASP.net web service if the above isn't specified , what is the response
Currently I have two MySQL tables Properties id name 1 Grove house 2 howard
I am having a very specific problem in JQuery The code below is used
The script below, test.php, is intended to be placed in a specific directory of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.