Ebean borrows from a subset of the JPA specification that allows you to markup how your objects map to the database using Java annotations.
You can hand code your entity classes, or use software such as the Dail Toolkit for the Eclipse IDE to auto-generate
classes from your database.
This entity class represents a site user who reviews products on a website. It was generated by Dali:
Notes:
- The
userId
field's annotations reflect that it is mapped to a primary key field with auto-increment enabled.
- The
productReviews
field illustrates how one to many relationships within the database can be managed.
- Ebean enhances the bytecode of the getter and setter methods so that appropriate actions against the database occur when they are called.