Oracle
1Z0-860 · Question #255
A developer implemented a Java class called Store. The class is annotated correctly to act as an entity. The developer created a stateless session bean to create, lookup, and remove Store objects…
The correct answer is C. The passed object is NOT managed by the entity manager. See the full explanation below for the reasoning.
Question
A developer implemented a Java class called Store. The class is annotated correctly to act as an entity. The developer created a stateless session bean to create, lookup, and remove Store objects. This session bean has a container-managed entity manager injected into field em and a removeStore method with transaction attribute REQUIRED. Given the following code : 32. public void re move St ore (St ore store) { 33. em.remove(store); 34.} What is a possible reason that an HlegalArgumentException is thrown at Line 33 when the removeStore method is called by a remote client?
Options
- AThe passed object is NOT serializable.
- BThe passed object is NOT found in the database.
- CThe passed object is NOT managed by the entity manager.
- DThere is no active transaction to manage the database removal.
How the community answered
(59 responses)- A2% (1)
- B5% (3)
- C80% (47)
- D14% (8)
Community Discussion
No community discussion yet for this question.