0
変更の履歴を保存したいので、@PostUpdateに別のエンティティの新しいインスタンスを作成して保存したいのですが、どのようにしてそのメソッドにEntityManagerを渡しますか?@PostUpdateにEntityManagerを渡す方法
あなたのクラスでの注射により1):
@PersistenceContext EntityManager em; // injected in your class
2)を使用してEntityManagerFactory:
動作しません。EntityManagerはnullです。 – IAdapter
mmmmmm ....奇妙な。わたしにはできる。 JPAの実装は何ですか?休止状態?あなたのコンテナは何ですか? JBoss? Tomcat? Weblogic? –
@PersistenceContextアノテーションは、EJBサーバーでのみ標準で動作します。 – Kdeveloper