6.3 Updating a database using entities

With Cosminexus JPA Provider, you can update a database using entities.

To use the JPA, the user must create an entity class for handling the database tables as Java objects. If you use the entity class, the data in the database is operated through Cosminexus JPA Provider. At this time, you operate the database through the EntityManager interface provided by Cosminexus JPA Provider.

The database operations using the entity class are as follows:

  1. Generating the entity class instance (entity object).
  2. Passing the entity object to the argument of the EntityManager interface to operate the database.
    To perform these operations, an entity class must be created.

EntityManager is an object used for operating the entities and controlling the states. The entity operations include the persist operation, remove operation, merge operation, flush operation, and refresh operation. For details on these operations, see 6.4.1 Transition of entity states.