Cosminexus アプリケーションサーバ V8 機能解説 基本・開発編(コンテナ共通機能)
アプリケーションが取得できる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) 2008, 2011, Hitachi, Ltd.