Eclipselink JPA(2.0)を使用しています。通常のプロパティ設定やリフレッシュまたは設定のヒントが機能しないため、すべてのキャッシュをクリアするにはentityManagerFactoryにアクセスする必要があります。EclipselinkのEntityManagerからEntityManagerFactoryにアクセスする方法
entityManager.getEntityManagerFactory().getCache().evictAll();
をしかし、EclipseLinkのEntityManagerの中getEntityManagerFactory(と呼ばれるそのような方法は)ありません:私は、コードのこの部分から、それを行うための方法を発見しました。どうすればいいですか?
私はEntityManagerFactoryにSpring Beanのコンフィグレーションを使用していますが、entityManagerにはDAOレイヤで@PersistenceContextというアノテーションが付けられています。 DAOで
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
<property name="jpaDialect" ref="jpaDialect" />
<property name="persistenceUnitName" value="MyService" />
</bean>
:
private EntityManager entityManager;
@PersistenceContext
public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
感謝のSpring Beanの設定で
。
JPA 2ベンダーは、同じインターフェースを使用しているため、リストされたメソッドの利用可能性とは何の関係もありません。実際の問題を診断できるように関連コードを投稿してください。 – Perception
ソースコードで編集してください。 – popcoder
あなたはどのバージョンのSpringを使用していますか?適切なJPA 2サポートが必要な場合は、バージョン3.0を使用する必要があります。 – Perception