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

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

A - DB2/NT

B - MySQL

C - FoundationDB

D - PostgreSQL

Answer : C

Explaination

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

Answer : D

Explaination

A Transaction represents a unit of work with the database and most of the RDBMS supports transaction functionality. Transactions in Hibernate are handled by an underlying transaction manager and transaction (from JDBC or JTA).This is an optional object and Hibernate applications may choose not to use this interface, instead managing transactions in their own application code.

Q 3 - Session.beginTransaction method begins a unit of work and returns the associated Transaction object.

A - true

B - false

Answer : A

Explaination

Session.beginTransaction method begins a unit of work and returns the associated Transaction object.

Q 4 - Which method is used to re-read the state of the given instance from the underlying database?

A - Session.refresh()

B - Session.get()

C - Session.reload()

D - Session.retrieve()

Answer : A

Explaination

Session.refresh re-reads the state of the given instance from the underlying database.

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.

Answer : A

Explaination

An employee can have multiple certificates and same certificate can be conferred to many employees. Such situation represents many-to-many association.

Answer : A

Explaination

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

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.

A - false

B - true

Answer : B

Explaination

You would need one SessionFactory object per database using a separate configuration file.

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