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

Q 1 - Which of the following is not an ORM framework?

A - Castor

B - Spring DAO

C - Hibernate

D - NoSQL

Answer : D

Explaination

NoSQL is not an ORM framework.

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.

Answer : A

Explaination

Once we close the Hibernate Session, the persistent instance will become a detached instance.

Answer : D

Explaination

The <class> elements are used to define specific mappings from a Java classes to the database tables. The Java class name is specified using the name attribute of the class element and the database table name is specified using the table attribute.

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.

Q 6 - Child objects are not loaded when parent is loaded/populated from database. What this technique is called?

A - Eager Loading

B - Lazy Loading

C - Request based Loading

D - None of the above.

Answer : B

Explaination

In lazy loading child objects are not loaded when parent is loaded.

Answer : D

Explaination

HQL takes java objects in the same way as SQL takes tables. HQL is a Object Oriented Query language and is database independent.

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