entitymanager persist

Solutions on MaxInterview for entitymanager persist by the best coders in the world

showing results for - "entitymanager persist"
Tiphaine
23 Nov 2017
1JPA uses the EntityManager API for runtime usage. 
2The EntityManager represents the application session or 
3dialog with the database. 
4Each request, or each client will 
5use its own EntityManager to access the database. 
6The EntityManager also represents a transaction context, 
7and in a typical stateless model 
8a new EntityManager is created for each transaction. 
9In a stateful model, an EntityManager may match the 
10lifecycle of a client's session.
11
12The EntityManager provides an API for all required 
13persistence operations. 
14These include the following CRUD operations:
15
16persist (INSERT)
17merge (UPDATE)
18remove (DELETE)
19find (SELECT)
20
21The EntityManager is an object-oriented API, 
22so does not map directly onto database SQL or DML operations. 
23For example to update an object, 
24you just need to read the object and change 
25its state through its set methods, 
26and then call commit on the transaction. 
27The EntityManager figures out which objects 
28you changed and performs the correct updates to the database, 
29there is no explicit update operation in JPA.
similar questions
queries leading to this page
entitymanager persist