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.createSQLQuery creates a new instance of Query for the given HQL query string.
Session.createSQLQuery creates a new instance of Query for the given SQL 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.Map property in hibernate?
java.util.Map property is mapped with a <map> element and initialized with java.util.HashMap.
Q 6 - Child objects are not loaded when parent is loaded/populated from database. What this technique is called?
In lazy loading child objects are not loaded when parent is loaded.
Q 7 - Whis of the following is true about second level cache in hibernate?
Second level cache is an optional cache and first-level cache will always be consulted before any attempt is made to locate an object in the second-level cache. The second-level cache can be configured on a per-class and per-collection basis and mainly responsible for caching objects across sessions.
Q 8 - When a Read-write concurrency strategy is to be used?
Use Read-write strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions.
Persistent objects are saved and retrieved through a Session object.
Q 10 - Which of the following is true about HQL?
Hibernate supports named parameters in its HQL queries. HQL supports a range of aggregate methods, similar to SQL.