Tuesday August 18, 2009
LOTD #22: How to inject JPA resources ? - PersistenceUnit vs PersistenceContext
Java Persistence API defines a standard object/relational mapping using
POJOs. In JPA, a persistence
unit is described using "persistence.xml", bundled with
the web application, injected into your web application and then POJOs
are used to access all the information from the underlying persistence
mechanism such as a database.
JPA can injected into your application couple of different ways as
shown below:
| @PersistenceUnit EntityManagerFactory emf; |
| @PersistenceContext EntityManager manager; |
Posted by Arun Gupta in General | Comments[1]
|
|
|
|
|
Today's Page Hits: 3389
Total # blog entries: 1002