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

Explaination

Query objects use SQL or Hibernate Query Language (HQL) string to retrieve data from the database and create objects. A Query instance is used to bind query parameters, limit the number of results returned by the query, and finally to execute the query.

Answer : D

Explaination

You can make a transient instance persistent by associating it with a Session. A persistent instance has a representation in the database, an identifier value and is associated with a Session.

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

Answer : A

Explaination

Hibernate implements a cache for query resultsets that integrates closely with the second-level cache.

Answer : C

Explaination

Hibernate detects that the @Id annotation is on a field and assumes that it should access properties on an object directly through fields at runtime.

Answer : A

Explaination

HQL supports INSERT INTO clause only where records can be inserted from one object to another object.

hibernate_questions_answers.htm
Advertisements