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 tools/frameworks provides integration with Hibernate?

A - XDoclet Spring

B - J2EE

C - Maven

D - All of the above.

Answer : D

Explaination

All of the above provide integration with Hibernate.

Answer : D

Explaination

The Configuration object is the first Hibernate object you create in any Hibernate application and usually created only once during application initialization. It represents a configuration or properties file required by the Hibernate.

Q 3 - Session.createQuery creates a new instance of Query for the given HQL query string.

A - true

B - false

Answer : A

Explaination

Session.createQuery creates a new instance of Query for the given HQL query string.

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

A - Session.store()

B - Session.keep()

C - Session.save()

D - Session.load()

Answer : C

Explaination

Session.save saves the state of the given instance from the underlying database.

Q 5 - Which of the following element maps java.util.Collection property in hibernate?

A - <set>

B - <list>

C - <bag>

D - <map>

Answer : C

Explaination

java.util.Collection property is mapped with a <bag> or <ibag> element and initialized with java.util.ArrayList.

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

Explaination

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

Answer : A

Explaination

Hibernate Annotations is the powerful way to provide the metadata for the Object and Relational Table mapping. All the metadata is clubbed into the POJO java file along with the code this helps the user to understand the table structure and POJO simultaneously during the development.

Q 10 - length attribute of @Column annotation permits the size of the column used to map a value particularly for a String value.

A - false

B - true

Answer : B

Explaination

length attribute of @Column annotation permits the size of the column used to map a value particularly for a String value.

hibernate_questions_answers.htm
Advertisements