Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic