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.
Q 1 - Which of the following is true about Hibernate?
All of the above options are true about Hibernate.
Q 2 - Which of the following is not a core component of Hibernate?
Provider is not a core component of Hibernate.
Q 3 - Session.createQuery creates a new instance of Query for the given HQL query string.
Session.createQuery creates a new instance of Query for the given HQL query string.
Q 4 - Which of the following is true about <id> element?
The <id> element maps the unique ID attribute in class to the primary key of the database table. The name attribute of the id 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.
Q 5 - Which of the following element maps java.util.Set property in hibernate?
java.util.Set property is mapped with a <set> element and initialized with java.util.HashSet.
Q 6 - Which of the following situation represents many-to-many relationship?
An employee can have multiple certificates and same certificate can be conferred to many employees. Such situation represents many-to-many association.
Q 7 - Which of the following is true about HQL?
HQL takes java objects in the same way as SQL takes tables. HQL is a Object Oriented Query language and is database independent.
Q 8 - Which of the following is true about query level cache in hibernate?
Query level cache is an optional feature and requires two additional physical cache regions that hold the cached query results and the timestamps when a table was last updated. This is only useful for queries that are run frequently with the same parameters.
Q 9 - You would need one SessionFactory object per database using a separate configuration file.
You would need one SessionFactory object per database using a separate configuration file.
Q 10 - Which of the following is true about @Table annotation?
The @Table annotation allows you to specify the details of the table that will be used to persist the entity in the database. The @Table annotation provides four attributes, allowing you to override the name of the table, its catalogue, and its schema, and enforce unique constraints on columns in the table.