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
    AutoTune
    Administrative control of AutoTune during runtime.
    BackgroundExecutor
    Background executor service for executing of tasks asynchronously.
    BeanState
    Provides access to the internal state of an entity bean.
    CallableSql
    For making calls to stored procedures.
    CancelableQuery
    Defines a cancelable query.
    Database
    Provides the API for fetching and saving beans to a particular database.
    DocumentStore
    Document storage operations.
    DtoQuery<T>
    Query for performing native SQL queries that return DTO Bean's.
    EbeanServer Deprecated.
    ExampleExpression
    Query by Example expression.
    Expression
    An expression that is part of a WHERE or HAVING clause.
    ExpressionFactory
    Expression factory for creating standard expressions.
    ExpressionList<T>
    List of Expressions that make up a where or having clause.
    ExtendedServer
    The extended API for Database.
    FetchGroup<T>
    Defines what part of the object graph to load (select and fetch clauses).
    FetchGroupBuilder<T>
    Builds a FetchGroup by adding fetch clauses.
    FetchPath
    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).
    Filter<T>
    Provides support for filtering and sorting lists of entities without going back to the database.
    FutureIds<T>
    FutureIds represents the result of a background query execution for the Id's.
    FutureList<T>
    FutureList represents the result of a background query execution that will return a list of entities.
    FutureRowCount<T>
    Represents the result of a background query execution for the total row count for a query.
    Junction<T>
    Represents a Conjunction or a Disjunction.
    MergeOptions
    Options used to control a merge.
    ModifyAwareType
    Owner object notified when a modification is detected.
    PagedList<T>
    Represents a page of results.
    ProfileLocation
    A location for profiling transactions and queries.
    Query<T>
    Object relational query for finding a List, Set, Map or single entity bean.
    QueryIterator<T>
    Used to provide iteration over query results.
    RawSql
    Used to build object graphs based on a raw SQL statement (rather than generated by Ebean).
    RawSqlBuilder
    Builds RawSql instances from a SQL string and column mappings.
    RowConsumer
    Used with SqlQuery to process potentially large queries reading directly from the JDBC ResultSet.
    RowMapper<T>
    Used with SqlQuery to map raw JDBC ResultSet to objects.
    ScriptRunner
    Runs DDL and SQL scripts.
    SqlQuery
    Query object for performing native SQL queries that return SqlRow or directly read ResultSet using a RowMapper.
    SqlQuery.TypeQuery<T>
    Query mapping to single scalar values.
    SqlRow
    Used to return raw SQL query results.
    SqlUpdate
    A SqlUpdate for executing insert update or delete statements.
    Transaction
    The Transaction object.
    TransactionCallback
    Provides a callback that can be registered with a Transaction.
    Update<T>
    An Insert Update or Delete statement.
    UpdateQuery<T>
    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.
    BeanRepository<I,​T>
    Provides finder functionality for use with "Dependency Injection style" use of Ebean.
    CountedValue<A>
    Holds a distinct value with it's count.
    DatabaseFactory
    Creates Database instances.
    DB
    DB is a registry of Database by name.
    DocStoreQueueEntry
    Bean holding the details to update the document store.
    Ebean Deprecated.
    EbeanServerFactory Deprecated.
    EbeanVersion
    Class to determine the ebean version.
    EmptyPagedList<T>
    An empty PagedList.
    Expr
    Expression factory for creating standard expressions for WHERE and HAVING clauses.
    FetchConfig
    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.
    MergeOptionsBuilder
    Builds a MergeOptions which is immutable and thread safe.
    Model
    A MappedSuperclass base class that provides convenience methods for inserting, updating and deleting beans.
    OrderBy<T>
    Represents an Order By for a Query.
    OrderBy.Property
    A property and its ascending descending order.
    Pairs
    Holds a list of value object pairs.
    Pairs.Entry
    A pair of 2 value objects.
    TransactionCallbackAdapter
    Adapter that can be extended for easier implementation of TransactionCallback.
    TxScope
    Holds the definition of how a transactional method should run.
    ValuePair
    Holds two values as the result of a difference comparison.
    Version<T>
    Wraps a version of a @History bean.
  • Enum Summary
    Enum Description
    CacheMode
    Enum to control the different cache modes for queryCache and beanCache.
    CountDistinctOrder
    DocStoreQueueEntry.Action
    Action to either update or delete a document from the index.
    Junction.Type
    The type of Junction used in full text expressions.
    LikeType
    Used to specify the type of like matching used.
    PersistenceContextScope
    Defines the scope for PersistenceContext.
    Query.LockType
    The lock type (strength) to use with query FOR UPDATE row locking.
    Query.LockWait
    FOR UPDATE wait mode.
    QueryType
    The type of the query being executed.
  • Exception Summary
    Exception Description
    AcquireLockException
    Thrown when failing to acquire a pessimistic lock.
    DataIntegrityException
    Thrown when a foreign key constraint is enforced.
    DuplicateKeyException
    Thrown when a duplicate is attempted on a unique constraint.
    PersistenceIOException
    Captures and wraps IOException's occurring during ElasticSearch processing etc.
    SerializableConflictException
    Thrown at SERIALIZABLE isolation level for non-recoverable concurrent conflict.