Show List

Quiz - JPA and Hibernate - 4

78%

Public Average Score
Select the right answer for below questions:

What is the purpose of the JPA EntityManager.merge() method?
To persist an entity in the database
To retrieve an entity from the database
To update an entity in the database
To delete an entity from the database
To update an entity in the database

What is the purpose of the JPA EntityManager.remove() method?
To persist an entity in the database
To retrieve an entity from the database
To update an entity in the database
To delete an entity from the database
To delete an entity from the database

What is the purpose of the Hibernate Session.saveOrUpdate() method?
To persist an entity in the database or update an existing entity in the database
To retrieve an entity from the database
To update an entity in the database
To delete an entity from the database
To persist an entity in the database or update an existing entity in the database

What is the difference between the Hibernate Session.save() and Session.persist() methods?
The Session.save() method does not return the generated identifier, while the Session.persist() method does
The Session.save() method returns the generated identifier, while the Session.persist() method does not
The Session.save() method and Session.persist() method are the same
None of the above
The Session.save() method returns the generated identifier, while the Session.persist() method does not

What is the difference between the Hibernate Session.get() and Session.load() methods?
The Session.get() method throws an exception if the entity does not exist, while the Session.load() method returns null
The Session.get() method returns a proxy object if the entity does not exist, while the Session.load() method returns the real object
The Session.get() method returns the real object if the entity does not exist, while the Session.load() method returns a proxy object
The Session.get() method returns null if the entity does not exist, while the Session.load() method throws an exception
The Session.get() method returns null if the entity does not exist, while the Session.load() method throws an exception

What is Lazy Initialization in Hibernate?
Lazy Initialization is the process of initializing an object's properties as soon as the object is created
Lazy Initialization is the process of initializing an object's properties immediately after they are accessed
Lazy Initialization is the process of initializing an object's properties only when they are needed
None of the above
Lazy Initialization is the process of initializing an object's properties only when they are needed

What is Eager Initialization in Hibernate?
Eager Initialization is the process of initializing an object's properties only when they are needed
Eager Initialization is the process of initializing an object's properties as soon as the object is created
Eager Initialization is the process of initializing an object's properties immediately after they are accessed
None of the above
Eager Initialization is the process of initializing an object's properties as soon as the object is created

What is the difference between the Hibernate Cache and JPA Shared Cache?
The Hibernate Cache is specific to Hibernate, while the JPA Shared Cache is specific to JPA
The Hibernate Cache is used for caching query results, while the JPA Shared Cache is used for caching entities
The Hibernate Cache is used for caching entities, while the JPA Shared Cache is used for caching query results
Both the Hibernate Cache and JPA Shared Cache are used for caching entities and query results
Both the Hibernate Cache and JPA Shared Cache are used for caching entities and query results

What is the purpose of the Hibernate Second Level Cache?
The purpose of the Hibernate Second Level Cache is to cache entities and query results in memory, reducing the number of database queries
The purpose of the Hibernate Second Level Cache is to cache query results in memory, reducing the number of database queries
The purpose of the Hibernate Second Level Cache is to cache entities in memory, reducing the number of database queries
None of the above
The purpose of the Hibernate Second Level Cache is to cache entities and query results in memory, reducing the number of database queries

What is the difference between the Hibernate First Level Cache and Second Level Cache?
The Hibernate First Level Cache is associated with the Hibernate SessionFactory, while the Second Level Cache is associated with the Hibernate Session
The Hibernate First Level Cache is associated with the Hibernate Session, while the Second Level Cache is associated with the Hibernate SessionFactory
Both the Hibernate First Level Cache and Second Level Cache are associated with the Hibernate Session
Both the Hibernate First Level Cache and Second Level Cache are associated with the Hibernate SessionFactory
The Hibernate First Level Cache is associated with the Hibernate Session, while the Second Level Cache is associated with the Hibernate SessionFactory

Submit
Retry
{"qz1-458948":"To update an entity in the database","qz1-458949":"To delete an entity from the database","qz1-458950":"To persist an entity in the database or update an existing entity in the database","qz1-458951":"The Session.save() method returns the generated identifier, while the Session.persist() method does not","qz1-458952":"The Session.get() method returns null if the entity does not exist, while the Session.load() method throws an exception","qz1-458953":"Lazy Initialization is the process of initializing an object's properties only when they are needed","qz1-458954":"Eager Initialization is the process of initializing an object's properties as soon as the object is created","qz1-458955":"Both the Hibernate Cache and JPA Shared Cache are used for caching entities and query results","qz1-458956":"The purpose of the Hibernate Second Level Cache is to cache entities and query results in memory, reducing the number of database queries","qz1-458957":"The Hibernate First Level Cache is associated with the Hibernate Session, while the Second Level Cache is associated with the Hibernate SessionFactory"}

    Leave a Comment


  • captcha text