Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!

santosh joshi

+ Follow
since Aug 20, 2007
Merit badge: grant badges
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by santosh joshi

I only want to cache some static read only tables like list of countries and every time this table gets hits the data should be read from the cache.

Paul Sturrock wrote:A cached query is a different thing from cached entities. Remember, queries do not necessarily load entities (i.e. select property1 from entity will just get that property). When you cache a query what you cache are the ids of entities that match the criteria when the query was run.

My understanding on your point is like

A query wil hit the database every time it got fired but if the query is cacheble the DB hit is saved for the second and subsequent times .
the query cache makes the query cachable but the secong level cache makes the Entities catchable based on their identifier(pk)

The second level cache is only used when accessing the object by Primary Key, means the searching for whole entities based on Primary Key
ie with session.get(), session.load() methods.

Please correct me if i am wrong.
I Need to implement ehcache in my existing project, for which i am using ehcache

  • WROTE ehcache.xml file

  • ENABLED cahcing in hibernate

  • ADDED entries in log4j for testing

  • I have and existing query like
    Now when i am running the above query in a loop for 10 times, it always hits the database and gets the result, the cache logs says "item already cached" also the SecondLevelCacheStatistics show 0 hits.
    Now when i added the setCacheable(true) to the below query
    The above worked and i got the expected result
    My question is that as i am working on existing maintaince project, do i need to add setCacheable(true) to every concerned query.
    Does second level caache depends on query cache (hibernate.cache.use_query_cache) ' value.

    I there any other way out so that i need not to write setCacheable(true) to every query?

    Thanks Guys,

    I am using a different trigger for this purpose


    "0 0 0 ? * 2-3,5 *"


    Mon Jan 17 00:00:00 IST 2011
    Tue Jan 18 00:00:00 IST 2011
    Thu Jan 20 00:00:00 IST 2011

    "0 0 0 ? * 2-3,5#4 *"

    Mon Jan 24 00:00:00 IST 2011
    Mon Feb 28 00:00:00 IST 2011
    Mon Mar 28 00:00:00 IST 2011
    Mon Apr 25 00:00:00 IST 2011

    so this returns wrong result

    I am using quartz 1.5.2,

    Getting no Error message, as the expression compiles successfully, outputting only monday, tuesday and wednesday,
    and ignores the thrusdays's value.

    seems THU#2,THU#4 creates problem
    I am getting problem in writing a cron Exp that triggers every monday,tuesday,wednesday and every 2nd and 4th Thrusday.

    I just wrote

    0 0 0 0 0 MON-WED,THU#2,THU#4 ?

    But this does not work.

    For providing data Encapsulation.
    13 years ago
    The java.util.Date class implements the Comparable interface. so even if you use the default TreeMap constructor then on putting the java.util.Date as Key the TreeMap will automatically sort by asc order of date

    13 years ago
    Reading that article just gave me a though that everyone seems to be excited both major browsers and a normal developer like me without waiting for the final Spec to come

    13 years ago
    Thanks Tim

    I too Googled and find out that the following browser supports Web Sockets

    Chrome 4.0
    Firefox 4.0 beta
    Opera 11 (or 10.70)
    Safari 5.0.2

    Also on Server Side Jetty 7.0 claims to have provided support for Web sockets and Servlet Spec3.0

    Santosh Joshi
    13 years ago

    Can anyone tell me whether Tomcat 7 provide support for HTML 5 web sockets and also what other servers provide support for HTML 5 Web sockets.

    13 years ago
    Hi , Dhiraj welcome to Javaranch, and congratulation for clearing SCJP 5.0
    I think you should try for SCWCD.
    yes both C and E are correct
    Bear and Eric for your valuable feedback.
    At last i got the answer actually i was using a wrong approach
    the problem was not so big but the way i was thinking of the solution was very complex.