Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
 

Oracle 1z0-898 Exam Actual Questions

The questions for 1z0-898 were last updated on July 8, 2024.
  • Viewing page 1 out of 16 pages.
  • Viewing questions 1-4 out of 63 questions

Topic 1 - Single Topic

Question #1 Topic 1

Entity lifecycle callback methods may be defined in which three classes? (Choose three)

  • A. Embedded classes
  • B. Entity classes
  • C. Abstract classes
  • D. Entity listener classes
  • E. Mapped superclasses
  • F. Concrete non-entity superclasses
Reveal Solution Hide Solution   Discussion  

Correct Answer: BDE 🗳️
Entity Listeners and Callback Methods
A method may be designated as a lifecycle callback method to receive notification of entity lifecycle events. A lifecycle callback method can be defined on an entity class, a mapped superclass, or an entity listener class associated with an entity or mapped superclass.
Reference: How to inject a spring's service bean into a JPA Entity?

http://stackoverflow.com/questions/3747268/how-to-inject-a-springs-service-bean-into-a-jpa-entity

Question #2 Topic 1

A developer wrote an entity class with the following method:
Private static Logger logger = Logger.getLogger ("myLogger");
@PrePersist
@PreUpdate
Public void doA () {
Logger.info ("A");
}
@PostPersist
@PostUpdate
Public void doB () {
logger.info ("B");
}
What will the log message contain when an application does the following?
1. Begins a transaction
2. Creates the entity
3. Persists the entity
4. Commits the transaction
5. Begins the entity data
6. Modifies the entity data
7. Merges the entity
8. Commits the second transaction

  • A. A A B B
  • B. A B A B
  • C. A B B A B
  • D. The application will throw an exception because multiple lifecycle callback annotations applied to a single method.
Reveal Solution Hide Solution   Discussion  

Correct Answer: B 🗳️

Question #3 Topic 1

Given the following code:
Public void create () {
try {
doA () {
} catch (PersistenceException e) {}
try (doB) ();
} catch (PersistenceException e) {}
}
Calling method doA will cause an NonUniqueResultException to be thrown. Calling method doB will cause an EntityExistsException to be thrown.
What two options describe what will happen when the create method is called within an application ' uses container managed transactions? (Choose two)

  • A. Method doB will never be called.
  • B. The current transaction will continue after doA executes.
  • C. The current transaction will continue after doB executes.
  • D. The current transaction will be marked for rollback when doA is called.
  • E. The current transaction will be marked for rollback when doB is called.
Reveal Solution Hide Solution   Discussion  

Correct Answer: BE 🗳️
B:
PersistenceException is thrown by the persistence provider when a problem occurs. All instances of PersistenceException except for instances of
NoResultException, NonUniqueResultException, LockTimeoutException, and QueryTimeoutException will cause the current transaction, if one is active, to be marked for rollback.
E: EntityExistsException is thrown by the persistence provider when EntityManager.persist(Object) is called and the entity already exists. The current transaction, if one is active, will be marked for rollback.
Reference: javax.persistence, Class PersistenceException
Reference: javax.persistence, Class EntityExistsException

Question #4 Topic 1

An application that uses pessimistic locking calls an updateData method that results in a LockTimeoutException being thrown. What three statements are correct?
(Choose three)

  • A. The current transaction continues.
  • B. The current statement continues.
  • C. The current transaction is rolled back.
  • D. The current statement is rolled back.
  • E. The LockTimeoutException can NOT be caught.
  • F. The LockTimeoutException can be caught, and the updateData method retried.
Reveal Solution Hide Solution   Discussion  

Correct Answer: ADF 🗳️
LockTimeoutException is thrown by the persistence provider when an pessimistic locking conflict occurs that does not result in transaction rollback. This exception may be thrown as part of an API call, at, flush or at commit time. The current transaction, if one is active, will be not be marked for rollback.
Reference: javax.persistence, Class LockTimeoutException

Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
ex Want to SAVE BIG on Certification Exam Prep?
close
ex Unlock All Exams with ExamTopics Pro 75% Off
  • arrow Choose From 1000+ Exams
  • arrow Access to 10 Exams per Month
  • arrow PDF Format Available
  • arrow Inline Discussions
  • arrow No Captcha/Robot Checks
Limited Time Offer
Ends in