Hibernate query cache does not cache the state of actual entities in the result set, and it caches only identifier values and results of value type. Query cache integrates closely with the second-level cache, and is useful for queries that are executed frequently with the same parameters. Continue reading
Daemon Thread in Java
Daemon thread is a service provider thread with low priority. Normally, it is used to provide service like background supporting tasks (garbage collection etc.). Its life depends on normal non-daemon threads. If all non-daemon threads are not running, the daemon thread will terminate. Continue reading
String to Integer (atoi) – LeetCode
Problem
Implement atoi to convert a string to an integer.
1 2 3 4 5 6 |
public class Solution { public int atoi(String str) { } } |
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Continue reading
Reverse Integer – LeetCode
Problem:
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321 Continue reading
Hibernate Second Level Cache Example
To enable second level cache, here we will use EHCache. Continue reading
Hibernate First Level Cache Example
A couple of examples are given to shows Hibernate first level cache scenario. Continue reading
Hibernate Caching
Caching is an import technique in Hibernate. When you use Hibernate in the application and enable Hibernate SQL trace, you might notice lots of SQL queries executed to grab data back from the database. A large number of such kinds of queries will finally slow down your application. Hibernate caching is a good choice to minimize the database hits and improve the performance of the application. Continue reading
Longest Palindromic Substring – LeetCode
Problem
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. Continue reading
Java Thread States and Life Cycle
Thread is a lightweight sub-process. The state diagram below shows Java thread state change and life cycle. Continue reading
Longest Substring Without Repeating Characters – LeetCode
Problem
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3. For “bbbbb” the longest substring is “b”, with the length of 1. Continue reading