This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Second level cache stores the object in a map, having primary key as Map's key and Object as map value. Second level cache is used only while accessing the object by primary key ie by using session.get(), session.load().
Query cache store the query result in map, having query and its parameters as Map's key and result as map value. Query cache can be used to cache & reuse the result of any query irrespective of primary key usage in it.