Package io.ebean


package io.ebean
Core API (see Database, DB and Query).

Database

Provides the main API for fetching and persisting beans. We can obtain the "default database" via DB.getDefault() or just use methods on DB.



// Example find by id

Order order = DB.find(Order.class, 10);


// Example save

Customer customer = DB.getReference(Customer.class, 42);

Order newOrder = new Order();
newOrder.setStatus(Order.Status.NEW);
newOrder.setCustomer(customer);
...

DB.save(newOrder);


// Example: Eagerly fetching associations

// fetch Customer 42 including their billing and shipping addresses
Customer customer = DB.find(Customer.class)
		.setId(42)
		.fetch("billingAddress")
		.fetch("shippingAddress")
		.findOne();

Address billAddr = customer.getBillingAddress();
Address shipAddr = customer.getShippingAddress();

  • Interface Summary
    Interface
    Description
    Administrative control of AutoTune during runtime.
    Background executor service for executing of tasks asynchronously.
    Provides access to the internal state of an entity bean.
    For making calls to stored procedures.
    Provides the API for fetching and saving beans to a particular database.
    Document storage operations.
    Query for performing native SQL queries that return DTO Bean's.
    Deprecated.
    Query by Example expression.
    An expression that is part of a WHERE or HAVING clause.
    Expression factory for creating standard expressions.
    List of Expressions that make up a where or having clause.
    The extended API for Database.
    Defines what part of the object graph to load (select and fetch clauses).
    Builds a FetchGroup by adding fetch clauses.
    Provides paths and properties for an object graph that can be used to control what parts of the object graph is fetching (select and fetch clauses) and also can be used to control JSON marshalling (what parts of the object graph are included in the JSON).
    Provides support for filtering and sorting lists of entities without going back to the database.
    FutureIds represents the result of a background query execution for the Id's.
    FutureList represents the result of a background query execution that will return a list of entities.
    Represents the result of a background query execution for the total row count for a query.
    Represents a Conjunction or a Disjunction.
    Options used to control a merge.
    Owner object notified when a modification is detected.
    Represents a page of results.
    A location for profiling transactions and queries.
    Object relational query for finding a List, Set, Map or single entity bean.
    Used to provide iteration over query results.
    Used to build object graphs based on a raw SQL statement (rather than generated by Ebean).
    Builds RawSql instances from a SQL string and column mappings.
    Used with SqlQuery to process potentially large queries reading directly from the JDBC ResultSet.
    Used with SqlQuery to map raw JDBC ResultSet to objects.
    Runs DDL and SQL scripts.
    Query object for performing native SQL queries that return SqlRow or directly read ResultSet using a RowMapper.
    Query mapping to single scalar values.
    Used to return raw SQL query results.
    A SqlUpdate for executing insert update or delete statements.
    The Transaction object.
    Provides a callback that can be registered with a Transaction.
    An Insert Update or Delete statement.
    An update query typically intended to perform a bulk update of many rows that match the query.
  • Class Summary
    Class
    Description
    BeanFinder<I,​T>
    Provides finder functionality for use with "Dependency Injection style" use of Ebean.
    Provides finder functionality for use with "Dependency Injection style" use of Ebean.
    Holds a distinct value with it's count.
    Creates Database instances.
    DB is a registry of Database by name.
    Bean holding the details to update the document store.
    Deprecated.
    Deprecated.
    Class to determine the ebean version.
    An empty PagedList.
    Expression factory for creating standard expressions for WHERE and HAVING clauses.
    Defines how a relationship is fetched via either normal SQL join, a eager secondary query, via lazy loading or via eagerly hitting L2 cache.
    Finder<I,​T>
    Intended to be used as a base class for 'Finder' implementations that can then be injected or used as public static fields on the associated entity bean.
    Builds a MergeOptions which is immutable and thread safe.
    A MappedSuperclass base class that provides convenience methods for inserting, updating and deleting beans.
    Represents an Order By for a Query.
    A property and its ascending descending order.
    Holds a list of value object pairs.
    A pair of 2 value objects.
    Adapter that can be extended for easier implementation of TransactionCallback.
    Holds the definition of how a transactional method should run.
    Holds two values as the result of a difference comparison.
    Wraps a version of a @History bean.
  • Enum Summary
    Enum
    Description
    Enum to control the different cache modes for queryCache and beanCache.
    Action to either update or delete a document from the index.
    The type of Junction used in full text expressions.
    Used to specify the type of like matching used.
    Defines the scope for PersistenceContext.
    The lock type (strength) to use with query FOR UPDATE row locking.
    FOR UPDATE wait mode.
    The type of the query being executed.
  • Exception Summary
    Exception
    Description
    Thrown when failing to acquire a pessimistic lock.
    Thrown when a foreign key constraint is enforced.
    Thrown when a duplicate is attempted on a unique constraint.
    Captures and wraps IOException's occurring during ElasticSearch processing etc.
    Thrown at SERIALIZABLE isolation level for non-recoverable concurrent conflict.