net.java.ao.EntityManagerの概要(javadocの日本語訳)

https://activeobjects.dev.java.net/api/net/java/ao/EntityManager.htmlのクラスの概要を翻訳しました。

本文

ActiveObjects API全体を制御する最上位クラス。EntityManagerはすべてのRawEntityオブジェクトの源泉であるとともにエンティティ間のディスパッチ層であり、プラグイン可能なテーブル名コンバータであり、かつ、データベースの抽象化層です。このクラスは、APIを使用する上での開始点となります。

The root control class for the entire ActiveObjects API. EntityManager is the source of all RawEntity objects, as well as the dispatch layer between the entities, the pluggable table name converters, and the database abstraction layers. This is the entry point for any use of the API.

EntityManagerは一つのインスタンスを一つのデータベースに対応させて使用するように設計されています。したがって、EntityManagerはシングルトンなインスタンスやスタティックなファクトリ・メソッドの代わりに、本来のコンストラクタを持っています。スタティックなインスタンスの管理は、APIを使用する開発者に任されています。

EntityManager is designed to be used in an instance fashion with each instance corresponding to a single database. Thus, rather than a singleton instance or a static factory method, EntityManager does have a proper constructor. Any static instance management is left up to the developer using the API.

備考ですが、ActiveObjectsではオプションですべてのSQLクエリを実行前にログ出力することできます。クエリのログ出力は、net.java.aoパッケージに対するJava Logging APIのLoggerインスタンスを使用して行われます。EntityManagerのスタティック初期化子により、ログ出力はデフォルトでは無効になっています。したがって、SQL文をログ出力する場合、EntityManagerクラスを一度使用した後に、LoggerレベルをLevel.FINEに設定する必要があります。通常、コンストラクタを呼び出した後に、ログ出力レベルの設定をすることになります。

As a side note, ActiveObjects can optionally log all SQL queries prior to their execution. This query logging is done with the Java Logging API using the Logger instance for the net.java.ao package. This logging is disabled by default by the EntityManager static initializer. Thus, if it is desirable to log the SQL statements, the Logger level must be set to Level.FINE after the EntityManager class is first used. This usually means setting the log level after the constructer has been called.

ポイント

  • AOのEntityManagerは通常のコンストラクタによりインスタンスを作成する。
  • Loggerレベルを設定してから、ActiveObjectsを使い始めても、ログ出力できない。