Hibernate Online Quiz


Advertisements


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 : B

Explaination

JDBC stands for Java Database Connectivity and provides a set of Java API for accessing the relational databases from Java program.

Q 2 - Which of the following is not a core component of Hibernate?

A - Transaction

B - Provider

C - Criteria

D - Query

Answer : B

Explaination

Provider is not a core component of Hibernate.

Answer : A

Explaination

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

Q 4 - Which method is used to save or update the state of the given instance from the underlying database?

A - Session.saveOrUpdate()

B - Session.keep()

C - Session.update()

D - Session.load()

Answer : A

Explaination

Session.saveOrUpdate either saves(Object) or updates(Object) the given instance.

Q 5 - Which of the following element is used to represent many-to-one relationship in hibernate?

A - <many-to-one>

B - <many-one>

C - <ManyToOne>

D - None of the above

Answer : A

Explaination

<many-to-one> element is used to define many-to-one association.

Answer : C

Explaination

save saves the object and returns the id of the instance whereas persist do not return anything after saving the instance.

Answer : D

Explaination

Second level cache is an optional cache and first-level cache will always be consulted before any attempt is made to locate an object in the second-level cache. The second-level cache can be configured on a per-class and per-collection basis and 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 - Configuration object is used to create SessionFactory object in hibernate.

A - true

B - false

Answer : A

Explaination

Configuration object is used to create a SessionFactory object.

Answer : C

Explaination

Hibernate supports named parameters in its HQL queries. HQL supports a range of aggregate methods, similar to SQL.


hibernate_questions_answers.htm

Advertisements