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.

Q 2 - Is SessionFactory a thread-safe object?

A - true

B - false

Answer : A

Explaination

Yes, SessionFactory is a thread-safe and can be accessed by multiple threads simultaneously.

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.

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 element of hbm.xml automatically generate the primary key values?

A - id

B - generator

C - primaryKey

D - None of the above.

Answer : B

Explaination

The <generator> element within the id element is used to automatically generate the primary key values.

Answer : A

Explaination

Lazy loading is a technique in which objects are loaded on demand basis.

Q 7 - Is query level caching mandatory in hibernate?

A - true

B - false

Answer : B

Explaination

query level cache is an optional cache.

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.

Q 10 - nullable attribute of @Column annotation permits the column to be marked NOT NULL when the schema is generated.

A - true

B - false

Answer : A

Explaination

nullable attribute of @Column annotation permits the column to be marked NOT NULL when the schema is generated.

hibernate_questions_answers.htm
Advertisements