Ebean
Encyclopedia
Ebean is an object-relational mapping
Object-relational mapping
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language...

 product written in Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

. It is designed to be simpler to use and understand than JPA
Java Persistence API
The Java Persistence API, sometimes referred to as JPA, is a Java programming language framework managing relational data in applications using Java Platform, Standard Edition and Java Platform, Enterprise Edition....

 (Java Persistence API) or JDO (Java Data Objects) products.

Simple API

Ebean has a simpler API than JPA. It achieves this through its 'Session Less' architecture. Ebean does not require a JPA EntityManager or JDO PersistenceManager and this removes the concepts of detached/attached beans and the issues associated with flushing/clearing and 'session management' of EntityManager's. This adds up to make Ebean's API much easier to learn understand and use.

Relational features

Although Ebean has full ORM features (equivalent to JPA) it also has incorporated 'SQL/Relational' features. The idea being that many development efforts require control over the exact sql, calling stored procedures or are more simply solved with 'Relational' approaches. The ultimate goal for Ebean is to combine the best ORM features from JPA with the best 'Relational' features from products like IBatis into a single persistence framework.

Object-relational mapping

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.

Examples



// find customer by id
Customer customer = Ebean.find(Customer.class, 1);

// more complex query with joins
List order =
Ebean.find(Order.class)
.join("customer")
.join("customer.billingAddress")
.join("customer.shippingAddress")
.join("details")
.join("details.product", "name")
.where.eq("shipDate", today)
.findList;


See also

  • Ebean Home
  • Hibernate
    Hibernate (Java)
    Hibernate is an object-relational mapping library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database...

  • Toplink
    TopLink
    In computing, TopLink is an object-relational mapping package for Java developers. It provides a framework for storing Java objects in a relational database or for converting Java objects to XML documents....

  • iBATIS
    IBATIS
    iBATIS is a persistence framework which automates the mapping between SQL databases and objects in Java, .NET, and Ruby on Rails. In Java, the objects are POJOs . The mappings are decoupled from the application logic by packaging the SQL statements in XML configuration files...

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK