| ||||||||||||||||||
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 |
Describes the basic create/remove api for persistent entities. Almost all applications need to add and remove entities from the database. Although most database accesses are reads, eventually we need to change the database. With Amber, you create a new instance with the following steps:
Files in this tutorial
Database SchemaThe example uses the same database table as the previous basic example. CREATE TABLE create_courses ( id BIGINT PRIMARY KEY auto_increment, course VARCHAR(250), instructor VARCHAR(250) ); Client ServletClients create a new bean and populate the fields just like
a normal Java object. The client adds the entry to the database
by calling the EntityManager's ... divination = new Course("Divination", "Sybil Trelawney"); _entityManager.persist(divination); ... _entityManager.remove(divination); ...
|