- 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 is true about Hibernate?
A - Hibernate is an Object-Relational Mapping(ORM) solution for JAVA.
B - Hibernate is an Object-Relational Mapping(ORM) solution for .NET
Answer : A
Explaination
Hibernate is an Object-Relational Mapping(ORM) solution for JAVA.
Answer : B
Explaination
No, Session is not thread-safe.
Q 3 - Session.createSQLQuery creates a new instance of Query for the given HQL query string.
Answer : B
Explaination
Session.createSQLQuery creates a new instance of Query for the given SQL query string.
Q 4 - Which of the following is true about <id> element?
A - The <id> element maps the unique ID attribute in class to the primary key of the database table.
B - The name attribute of the id element refers to the property in the class.
C - The column attribute of the id element refers to the column in the database table.
Answer : D
Explaination
The <id> element maps the unique ID attribute in class to the primary key of the database table. The name attribute of the id element refers to the property in the class and the column attribute refers to the column in the database table. The type attribute holds the hibernate mapping type, this mapping types will convert from Java to SQL data type.
Q 5 - Which element of hbm.xml is used to map a Java class property to a column in the database table?
Answer : C
Explaination
The <property> element is used to map a Java class property to a column in the database table.
Q 6 - Child objects are not loaded when parent is loaded/populated from database. What this technique is called?
Answer : B
Explaination
In lazy loading child objects are not loaded when parent is loaded.
Answer : B
Explaination
query level cache is an optional cache.
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.
Answer : A
Explaination
A Session is used to get a physical connection with a database.
Q 10 - Which of the following is true about @Table annotation?
Answer : C
Explaination
The @Table annotation allows you to specify the details of the table that will be used to persist the entity in the database. The @Table annotation provides four attributes, allowing you to override the name of the table, its catalogue, and its schema, and enforce unique constraints on columns in the table.