Which two of the following statements are correct?

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?

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?

A.
The name property was loaded from the database.

B.
The name property was NOTbeloaded from the database.

C.
The name property may or may not have been loaded from the database.

D.
The photo property was loaded from the database.

E.
The photo property was NOT loaded from the database.

F.
The photo property may or may not have been loaded from the database.

Explanation:
http://docs.oracle.com/javaee/6/api/javax/persistence/PersistenceUtil.html



Leave a Reply 3

Your email address will not be published. Required fields are marked *


test

test

A and F are correct

3.2.9 Load State : An entity is considered to be loaded if all attributes with FetchType.EAGER—whether explicitly 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.

When an attribute is marked as LAZY, the persistence provider may choose not to load it from the database until it is actually accessed. PersistenceUtil.isLoaded returns true if all the attributes that are not marked as LAZY are loaded. Therefore, by looking at the return value of isLoaded, you cannot tell whether a LAZY attribute has been loaded or not.