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

Answer : D

Explaination

SessionFactory object configures Hibernate for the application using the supplied configuration file and allows for a Session object to be instantiated. The SessionFactory is a thread safe object and used by all the threads of an application.

Q 3 - Session.createCriteria creates a new Criteria instance, for the given entity class, or a superclass of an entity class.

A - true

B - false

Answer : A

Explaination

Session.createCriteria creates a new Criteria instance, for the given entity class, or a superclass of an entity class.

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

A - Session.store()

B - Session.keep()

C - Session.update()

D - Session.load()

Answer : C

Explaination

Session.update updates 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-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 one-to-one association.

Answer : D

Explaination

The first-level cache is the Session cache and is a mandatory cache through which all requests must pass. The Session object keeps an object under its own power before committing it to the database.

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

A - DB2/NT

B - PostgreSQL

C - Sybase SQL Server

D - All of the above

Answer : D

Explaination

All of the above mentioned databases are supported by Hibernate.

Q 9 - The Session object is lightweight.

A - false

B - true

Answer : B

Explaination

The Session object is lightweight and designed to be instantiated each time an interaction is needed with the database.

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