nerdexam
Oracle

1Z0-898 · Question #14

A user entity is retrieved in a query and stored in an instance variable user. The user entity has a single valued name property that uses the mapping defaults, and a photo property, which is lazily…

The correct answer is A. The name property was loaded from the database. F. The photo property may or may not have been loaded from the database. An entity is considered to be loaded if all attributes with FetchType.EAGER--whether explictly specified or by default--(including relationship and other collection-valued attributes) have been loaded from the database or assigned by the application. Attributes with…

Advanced Topics

Question

A user entity is retrieved in a query and stored in an instance variable user. The user entity has a single valued name property that uses the mapping defaults, and a photo property, which is lazily loaded. The application then calls the following method: PersistenceUtil.isLoaded (user); Which two of the following statements are correct?

Options

  • AThe name property was loaded from the database.
  • BThe name property was NOTbeloaded from the database.
  • CThe name property may or may not have been loaded from the database.
  • DThe photo property was loaded from the database.
  • EThe photo property was NOT loaded from the database.
  • FThe photo property may or may not have been loaded from the database.

How the community answered

(27 responses)
  • A
    74% (20)
  • B
    7% (2)
  • C
    4% (1)
  • D
    4% (1)
  • E
    11% (3)

Explanation

An entity is considered to be loaded if all attributes with FetchType.EAGER--whether explictly specified or by default--(including relationship and other collection-valued attributes) have been loaded from the database or assigned by the application. Attributes with FetchType.LAZY may or may not have been loaded. Reference:What does PersistenceUtil.isLoaded means?;javax.persistence,Interface PersistenceUtil

Topics

#lazy loading#PersistenceUtil.isLoaded#fetch type#entity state

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice