
- Hibernate - Home
- ORM - Overview
- Hibernate - Overview
- Hibernate - Architecture
- Hibernate - Environment
- Hibernate - Configuration
- Hibernate - Sessions
- Hibernate - Persistent Class
- Hibernate - Mapping Files
- Hibernate - Mapping Types
- Hibernate - Examples
- Hibernate - O/R Mappings
- Hibernate - Cascade Types
- Hibernate - Annotations
- Hibernate - Query Language
- Hibernate - Criteria Queries
- Hibernate - Native SQL
- Hibernate - Caching
- Hibernate - Entity Lifecycle
- Hibernate - Batch Processing
- Hibernate - Interceptors
- Hibernate - ID Generator
- Hibernate - Saving Image
- Hibernate - log4j Integration
- Hibernate - Spring Integration
- Hibernate - Struts 2 Integration
- Hibernate - Web Application
- Mapping Table Examples
- Hibernate - Table Per Hiearchy
- Hibernate - Table Per Concrete Class
- Hibernate - Table Per Subclass
Hibernate Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to Hibernate Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Q 1 - Which of the following database is not supported by Hibernate?
Answer : C
Explaination
FoundationDB is a NoSQL database and is not supported by Hibernate.
Q 2 - Which of the following is true about Query object in hibernate?
B - Query objects SQL string to retrieve data from the database and create objects.
Answer : D
Explaination
Query objects use SQL or Hibernate Query Language (HQL) string to retrieve data from the database and create objects. A Query instance is used to bind query parameters, limit the number of results returned by the query, and finally to execute the query.
Q 3 - Which of the following is true about hibernate.dialect property in hibernate configuration?
A - This property makes Hibernate generate the appropriate SQL for the chosen database.
B - This property makes Hibernate generate the appropriate java code for the chosen database.
Answer : A
Explaination
This property makes Hibernate generate the appropriate SQL for the chosen database.
Q 4 - Which of the following is true about <class> element?
B - The Java class name is specified using the name attribute of the class element.
C - The database table name is specified using the table attribute of the class element.
Answer : D
Explaination
The <class> elements are used to define specific mappings from a Java classes to the database tables. The Java class name is specified using the name attribute of the class element and the database table name is specified using the table attribute.
Q 5 - Which of the following element maps java.util.SortedMap property in hibernate?
Answer : D
Explaination
This is mapped with a <map> element and initialized with java.util.TreeMap. The sort attribute can be set to either a comparator or natural ordering.
Q 6 - What is the difference between save() and persist() methods of session object?
B - save saves the object and returns status whereas persist stores status in different variable.
Answer : C
Explaination
save saves the object and returns the id of the instance whereas persist do not return anything after saving the instance.
Q 7 - Whis of the following is true about first level cache in hibernate?
A - The first-level cache is the Session cache.
B - The first-level cache is a mandatory cache through which all requests must pass.
C - The Session object keeps an object under its own power before committing it to the database.
Answer : D
Explaination
The first-level cache is the Session cache and is a mandatory cache through which all requests must pass. The Session object keeps an object under its own power before committing it to the database.
Q 8 - When a Read-only concurrency strategy is to be used?
Answer : C
Explaination
Read-only concurrency strategy is suitable for data which never changes. Use it for reference data only.
Q 9 - You would need one SessionFactory object per database using a separate configuration file.
Answer : B
Explaination
You would need one SessionFactory object per database using a separate configuration file.
Q 10 - Which of the following is true about @GeneratedValue annotation?
A - @GeneratedValue annotation takes two parameters strategy and generator.
B - @GeneratedValue annotation provides the primary key generation strategy to be used.
Answer : C
Explaination
By default, the @Id annotation will automatically determine the most appropriate primary key generation strategy to be used but you can override this by applying the @GeneratedValue annotation which takes two parameters strategy and generator.