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 database is not supported by Hibernate?

A - DB2/NT

B - MySQL

C - FoundationDB

D - PostgreSQL

Answer : C

Explaination

FoundationDB is a NoSQL database and is not supported by Hibernate.

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.createQuery creates a new instance of Query for the given HQL query string.

A - true

B - false

Answer : A

Explaination

Session.createQuery creates a new instance of Query for the given HQL query string.

Q 4 - Which of the following elements is used to define specific mappings from a Java classes to the database tables?

A - property

B - hibernate-config

C - class

D - class-config

Answer : C

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.

Answer : D

Explaination

The <property> element is used to map a Java class property to a column in the database table. The name attribute of the element refers to the property in the class and the column attribute refers to the column in the database table. The type attribute holds the hibernate mapping type, this mapping types will convert from Java to SQL data type.

Answer : A

Explaination

The first-level cache is the Session cache and is a mandatory cache through which all requests must pass.

Answer : B

Explaination

Use Transactional strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions.

Q 9 - You would need one SessionFactory object per database using a separate configuration file.

A - false

B - true

Answer : B

Explaination

You would need one SessionFactory object per database using a separate configuration file.

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
E-Books Store