ehcache 検索 API を使用して、第 2 レベルのキャッシュを検索できますか?
メソッドを使用してキャッシュにオブジェクトを直接put()
入力すると、SearchAttribute を使用して検索できます。第 2 レベルの Hibernate キャッシュをクエリしようとしているときに、ehcache 内のオブジェクトの逆アセンブル状態からエンティティをアセンブルすることに行き詰まっています。
public class TestExtr implements AttributeExtractor {
@Override
public Object attributeFor(Element element, String arg1)
throws AttributeExtractorException {
return element.?() ; //how to cast its value to Employee?
}
}
私のエンティティの例
public class Employee implements Serializable {
private int id;
private String firstName;
private String lastName;
private int salary;
// getters and setters
}
Element element
二次キャッシュの値は次のとおりです。
org.hibernate.cache.ehcache.internal.strategy.AbstractReadWriteEhcacheAccessStrategy$Item@6b8efd7c
key = test.Employee#1383
CacheEntry(test.Employee)[aaaaa,dd,77]