nerdexam
Oracle

1Z0-898 · Question #32

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"); }…

The correct answer is B. A. https://docs.jboss.org/hibernate/entitymanager/3.5/reference/en/html/listeners.html

Advanced Topics

Question

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

Options

  • AA
  • BA
  • CA
  • DThe application will throw an exception because multiple lifecycle call-back annotations applied to

How the community answered

(28 responses)
  • A
    4% (1)
  • B
    79% (22)
  • C
    14% (4)
  • D
    4% (1)

Explanation

https://docs.jboss.org/hibernate/entitymanager/3.5/reference/en/html/listeners.html

Topics

#lifecycle callbacks#@PrePersist#@PostPersist#@PreUpdate

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice