Package io.ebean

Core API (see Database, DB and Query).


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();

// Example: Eagerly fetching associations

// fetch Customer 42 including their billing and shipping addresses
Customer customer = DB.find(Customer.class)

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