Oracle
1Z0-860 · Question #27
Which is a valid way of injecting a container-managed transaction-scoped persistence context into an EJB 3.0 session bean assuming the application contains only one persistence unit?
The correct answer is B. @PersistenceContext private EntityManager em. See the full explanation below for the reasoning.
Question
Which is a valid way of injecting a container-managed transaction-scoped persistence context into an EJB 3.0 session bean assuming the application contains only one persistence unit?
Options
- A@PersistenceUnit public EntityManager em;
- B@PersistenceContext private EntityManager em;
- C@TransactionManagement(TransactionManagementType.
- D@Resource(name="persistence/em", authenticationType=AuthenticationType.
How the community answered
(49 responses)- A6% (3)
- B78% (38)
- C14% (7)
- D2% (1)
Community Discussion
No community discussion yet for this question.