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.

Questions and Answers

Answer : D

Explaination

JDBC stands for Java Database Connectivity and provides a set of Java API for accessing the relational databases from Java program. These Java APIs enables Java programs to execute SQL statements and interact with any SQL compliant database.

Q 2 - Is SessionFactory a thread-safe object?

A - true

B - false

Answer : A

Explaination

Yes, SessionFactory is a thread-safe and can be accessed by multiple threads simultaneously.

Answer : A

Explaination

This property makes Hibernate generate the appropriate SQL for the chosen database.

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.

Answer : D

Explaination

The <property> element is used to map a Java class property to a column in the database table. The name attribute of the 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 6 - What is value of lazy loading by default?

A - true

B - false

Answer : A

Explaination

Since Hibernate 3, lazy loading is by default, enabled so that child objects are not loaded when parent is loaded.

Answer : A

Explaination

The second-level cache is the SessionFactory based cache and is mainly responsible for caching objects across sessions.

Q 8 - Which of the following database is not supported by Hibernate?

A - Oracle

B - Microsoft SQL Server Database

C - FoundationDB

D - Informix Dynamic Server

Answer : C

Explaination

FoundationDB is a NoSQL database and is not supported by Hibernate.

Q 9 - The SessionFactory is heavyweight object.

A - false

B - true

Answer : B

Explaination

The SessionFactory is heavyweight object so usually it is created during application start up and kept for later use.

Answer : C

Explaination

Hibernate Query Language (HQL) is an object-oriented query language, similar to SQL, but instead of operating on tables and columns, HQL works with persistent objects and their properties.

hibernate_questions_answers.htm
Advertisements