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

Explaination

ORM stands for Object-Relational Mapping (ORM) is a programming technique for converting data between relational databases.

Q 2 - Which of the following object is used to create SessionFactory object in hibernate?

A - Configuration

B - Session

C - SessionFactory

D - Transaction

Answer : A

Explaination

Configuration object is used to create a SessionFactory object.

Answer : A

Explaination

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

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.

Q 5 - Which element of hbm.xml is used to map a Java class property to a column in the database table?

A - id

B - generator

C - property

D - class

Answer : C

Explaination

The <property> element is used to map a Java class property to a column in the database table.

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

A - <one-to-many>

B - <one-many>

C - <OneToMany>

D - None of the above.

Answer : A

Explaination

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

Answer : A

Explaination

The first-level cache is the Session cache and is a mandatory cache through which all requests must pass.

Answer : C

Explaination

Read-only concurrency strategy is suitable for data which never changes. Use it for reference data only.

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 supports named parameters in its HQL queries. HQL supports a range of aggregate methods, similar to SQL.

hibernate_questions_answers.htm
Advertisements