• Post Reply Bookmark Topic Watch Topic
  • New Topic

How does NVP based cache stores an object representing a database row?  RSS feed

Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, so most JPA implementations support caching. For Hibernate it's common to use EhCache as a 2nd level cache. But EhCache is a name value pair (NVP) based cache so while I understand how it can store NVP items, I can't see how the value being stored actually represents the whole of a database row which is represented as an entity object.

Here's what I'm thinking ...
Database -> Second Level Cache -> First Level Cache -> Entity Class
A row in the database table -> Value of a NVP in EhCache -> PersistenceContext -> Entity Object

Given the typical code example looks like this, does this mean instead of storing the text "value1" as the value, it stores an object that represents the Entity Object which represents the specific row retrieved from the database? If yes, is there a limit on the size of the object that can be stored as a value? Also, what would be used to key this value?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!