| ||||||||||
Resin 3.1 Documentation Examples Changes Quercus Database Amber EJB SOA/ESB IoC JMS Servlet JMX Hessian Security Field Property Create Query Many-to-One One-to-Many Many-to-Many Inherit Sessions |
FieldAmber's persistence supports a field-based relational model: each Java field represents a database column. The tutorial shows the configuration, classes, and client code for a single-table entity. PropertyBasic persistence example showing configuration, classes, and client code for a single-table bean. This example focuses on:
CreateDescribes the basic create/remove api for persistent entities. QueryThe Amber Query API resembles the JDBC PreparedStatement with enhanced SQL and direct support for objects. Many-to-OneThe Many-to-One link is the foundation of persistent relations. It links a source table to a destination with a database REFERENCES column. Many-to-One adds two capabilities: SQL extensions for links and direct lookup of target beans through field references. One-to-ManyThe @OneToMany relation adds collection extensions to the query language and provides a Java Collection containing the children. @OneToMany represents a collection of children belonging to a parent, like students in Gryffindor house at Hogwarts school. The Many-To-One tutorial illustrated that a many-to-one relation links one source entity to another target entity. A one-to-many relation links the target entity back to the source entity. In this example, each House has many Students, each Student has one House. House has a one-to-many relationship with Student, Student has a many-to-one relationship with House Many-to-ManyIllustrates using many-to-many relations of EJB 3.0. InheritAmber supports database-backed inheritance, allowing for persistent-backed polymorphism and more sophisticated object-oriented modelling. The example uses a single table to represent both Student and Prefect values. The "type" column serves as a discriminator to select the proper type. SessionsHttpSessions combined with Amber improve the flexibility and performance of persistent sessions.
|