Ebean

出典: フリー百科事典『ウィキペディア(Wikipedia)』
Ebean
開発元 Avaje
最新版
3.3.1 / 2014年4月4日 (9年前) (2014-04-04)
リポジトリ ウィキデータを編集
プログラミング
言語
Java
対応OS クロスプラットフォーム
プラットフォーム Java
サイズ 5.8 MB (展開後)
サポート状況 アクティブ
種別 オブジェクト関係マッピング
ライセンス LGPL license
公式サイト www.avaje.org
テンプレートを表示

Ebeanは、Javaのためのオブジェクト関係マッピング (ORM)ライブラリである。JPA (Java Persistence API) やJDO (Java Data Objects) よりもシンプルに使えて、かつ理解しやすいように設計されている。

シンプルなAPI[編集]

EbeanはJPAよりもシンプルなAPIを持っている。これは、セッションレスのアーキテクチャを持つことにより可能となった。EbeanはJPAの EntityManagerやJDOのPersistenceManagerを必要としない。これによりbeansの付け外しや、flushing/clearingとEntityManagersの「セッション管理」に関連した問題のコンセプトは不要となった。これにより、EbeanのAPIを学習、理解して使用することはより簡単になった。

リレーショナル機能[編集]

Ebeanは(JPAと同じく)完全なORMの機能を有しているが、「SQL」の機能も組み込まれている。方法として、正確にSQLを操作するのは多大な開発側の労力が必要となるので、ストアドプロシージャを呼び出すか、もっと単純に「リレーショナル」なアプローチで解決している。 The ultimate goal for Ebean is to combine the best ORM features from JPA with the best 'Relational' features from products like MyBatis into a single persistence framework.

オブジェクト関係マッピング[編集]

Ebean uses the same mapping as JPA with its @Entity, @Table, @OneToMany etc. annotations and xml. The mapping of Entity beans should be compatible between Ebean and JPA.

Going beyond JPA Ebean supports Java Generics and fetching "Partial" objects with its Query object.

[編集]

//idによりcustomerを見つける
Customer customer = Ebean.find(Customer.class, 1);

// joinsを使った、より複雑なクエリ
List<Order> order =
   Ebean.find(Order.class)
    .join("customer")
    .join("customer.billingAddress")
    .join("customer.shippingAddress")
    .join("details")
    .join("details.product", "name")
    .where().eq("shipDate", today)
    .findList();

関連項目[編集]

外部リンク[編集]