I would like to
- Cache instances of class Cat each time I call saveOrUpdate(Cat cat)
- Retrieve Cat instances from the cache when I run a query findByName(String catName) - cat name is not a primary key
It looks like that the second level cache cannot help, because my understanding is that it works with primary keys only. Moreover, I am not even sure that the Cat instances will be put in the cache when I call saveOrUpdate(Cat cat).
Any suggestion? Thanks!