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

Explaination

JDBC stands for Java Database Connectivity and provides a set of Java API for accessing the relational databases from Java program.

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 get a persistent instance from the datastore?

A - Session.read()

B - Session.get()

C - Session.retrieve()

D - Session.fetch()

Answer : B

Explaination

Session.get returns the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance.

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.

Answer : A

Explaination

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

Answer : A

Explaination

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

Answer : C

Explaination

Read-only concurrency strategy is suitable for data which never changes. Use it for reference data only.

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 supports named parameters in its HQL queries. HQL supports a range of aggregate methods, similar to SQL.

hibernate_questions_answers.htm
Advertisements