This Hibernate quiz assesses knowledge on configuration methods, session management, and core interfaces. It evaluates understanding of Hibernate's XML tags and object states, crucial for developers working with Java persistence layers.
Session is a light weight non-threadsafe object
You can share the session between threads
Session represents a single unit-of-work with the database
Session is the primary interface for the persistence service
A session loads database connections using lazy-loading
Rate this question:
Rate this question:
DTD
JDBC connection
SQL variant to generate
Mapping files
Size of the database
Rate this question:
Configuration interface
Session interface
Query and Criteria interfaces
User Interface
Configuration interface
Rate this question:
Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier
Created during application initialization
Wraps a JDBC connection
Act as Factory for Transaction
Rate this question:
Create HQL Query
Execute query to get list containing Java objects
Create session from configuration object
Load the Hibernate configuration file and create configuration object
Get one session from the session factory
Rate this question:
Session.save()
Session.remove()
Session.saveorupdate()
Session.persist()
Session.load()
Rate this question:
Rate this question:
You must have a default no-argument constructor for your persistent classes and there should be getXXX() (i.e accessor/getter) and setXXX( i.e. mutator/setter) methods for all your persistable instance variables.
You should implement the equals() and hashCode() methods based on your business key and it is important not to use the id field in your equals() and hashCode() definition if the id field is a surrogate key (i.e. Hibernate managed identifier). This is because the Hibernate only generates and sets the field when saving the object.
It is recommended to implement the Serializable interface. This is potentially useful if you want to migrate around a multi-processor cluster.
The persistent class should be final because if it is final then lazy loading can be used by creating proxy objects.
Rate this question:
Quiz Review Timeline (Updated): Mar 21, 2023 +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.
Wait!
Here's an interesting quiz for you.