EJB仕様要約

第3者に役立つ内容ではないけれど、はてな市民維持のために、投稿。
仕事でやっているNDAっぽい内容の調査メモ。もしあれなら無視してください。

第6章:エンティティのパッケージング

6.2 永続化単位(persistence unit)のパッケージング


All persistence classes defined at the level of the Java EE EAR must be accessible
to all other Java EE components in the application --- i.e. loaded by the application
classloader
-- such that if the same entity class is referenced by two different Java
EE components (which may be using difference persistence units), the referenced class
is the same identical class.
この記述で自分の中で知りたかったことはほぼ答えがでたのだけどついでにちょっと先を翻訳。

第7章:配備(Deployment)と起動(Bootstrap)のためのコンテナとプロバイダの規約

7.1.1 コンテナの責務

配備時、コンテナには、persistence.xmlを探し出して処理する責務がある。
persistence.xmlを見つけたら、スキーマのヴァリデーションを行う。xmlにプロバイダやDataSource情報が指定されてなかったら、デプロイ時に指定するかコンテナにデフォルトが設定されてないといけない。
メタデータを読み終わったら、コンテナは、デプロイされた各persistence unit単位にPersistenceProviderを特定して、インスタンス化し、そのcreateContainerEntityManagerFactory()メソッドを呼ぶ。

7.1.2 Persistence providerの責務

createContainerEntityManagerFactory()の引数として渡されたメタデータを読み、その情報に基づいてEntityManagerFactoryのインスタンスを生成してコンテナに返す。

persistence providerは当該persistence unitの被管理クラスのメタデータアノテーションを処理する。