appengine で datanucleus jpa レベル 2 キャッシュを使用しようとしています。
appengine の設定方法がよくわかりません。
私は次のものを持っています
persistence.xml
<property name="datanucleus.cache.level2" value="true"/>
<property name="datanucleus.cache.level2.type" value="javax.cache"/>
<property name="datanucleus.cache.level2.cacheName" value="xxxxx"/>
そしてMavenスニペット
pom.xml
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-jpa</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-cache</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.google.appengine.orm</groupId>
<artifactId>datanucleus-appengine</artifactId>
<version>1.0.10</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>1.1.5</version>
</dependecny>
問題は、エンティティを永続化すると、主キーが返されますが、データストア ビューアーまたは他のクエリからは利用できません。この問題は、ローカル開発、junit テスト、または appengine のリモート インスタンスで発生します。
キャッシュ構成が削除されるとすぐに、コードは正常に機能します。
テストのスニペット
@Test
public void findById(){
MerchantPromotion merchantPromotion1 = new MerchantPromotion();
em.persist(merchantPromotion1);
MerchantPromotion merchantPromotion = dao.findById( merchantPromotion1.getKey() );
assertNotNull( merchantPromotion); <---- assert fails here
}
どうした?
ありがとう
-lp