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?
Hibernate is an Object-Relational Mapping(ORM) solution for JAVA.
Q 2 - Which of the following is true about Query object in hibernate?
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.
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 the root node of hbm.xml file?
The mapping document is an XML document having <b><hibernate-mapping></b> as the root element which contains all the <class> elements.
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 element is used to represent many-to-many relationship in hibernate?
<many-to-many> element is used to define many-to-many association.
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.
Q 8 - When a Nonstrict-read-write concurrency strategy is to be used?
Nonstrict-read-write strategy makes no guarantee of consistency between the cache and the database. Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical concern.
Q 9 - Which of the following is true about hibernate annotations?
Hibernate Annotations is the powerful way to provide the metadata for the Object and Relational Table mapping. All the metadata is clubbed into the POJO java file along with the code this helps the user to understand the table structure and POJO simultaneously during the development.
Q 10 - Which of the following is true about INSERT CLAUSE in HQL?
HQL supports INSERT INTO clause only where records can be inserted from one object to another object.