Cosminexus V9 アプリケーションサーバ 機能解説 基本・開発編(コンテナ共通機能)
アプリケーションが取得できるEntityManagerの型は,JPAプロバイダのEntityManagerオブジェクトではなく,アプリケーションサーバが提供するEntityManagerのプロキシクラスです。
EntityManagerオブジェクトは,インジェクション,JNDIルックアップ,またはEntityManagerFactoryで取得できます。
なお,インジェクションを使用してEntityManagerを取得する場合には,EntityManagerをインジェクトするフィールドまたはメソッド引数の型は,javax.persistence.EntityManagerにしてください。
また,インジェクション,JNDIルックアップ,またはEntityManagerFactoryで取得したEntityManagerは,JPAプロバイダのEntityManagerの実装クラスにキャストできません。
JPAプロバイダのEntityManagerオブジェクトを取得する必要がある場合は,インジェクション,JNDIルックアップ,またはEntityManagerFactoryで取得したEntityManagerプロキシオブジェクトのgetDelegateメソッドを使用してください。
All Rights Reserved. Copyright (C) 2012, 2015, Hitachi, Ltd.