Related: Trouble Shooting


We can have our entity beans extend io.ebean.Model. They then have save() and delete() methods.

BaseDomain extends Model ...

import io.ebean.Model;

public abstract class BaseDomain extends Model {



Now we can just save() and delete() them:

Customer customer = new Customer("Jack");

// just save the bean;

// and delete it ...

Note that and Model.delete() use the default database. We obtain the default database via DB.getDefault().

Model vs Repository

We don't have to use Model and the common alternative is to use the repository pattern where we create a Repository for each entity type - e.g. CustomerRepository for the Customer entity bean and OrderRepository for the Order entity bean and so forth.

The recommended approach is to use Model and Finder rather than the Repository pattern. For more details goto ... TODO

Edit Page