Hibernate Pre-Training Tests Q1) Which of the following statements are true? a) RDBMS tables can be directly mapped to Java objects. b) RDBMS has no direct way to represent inheritance relationships c) ‘Table-per-class’ strategy can be used to implement polymorphic associations. d) Domain-model is dependent on the ORM tool being used. Q2) What is the default filename of Hibernate configuration file used in an webapplication? a) hibernate.config.properties b) hib.config.xml c) hibernate.cfg.xml d) None of the above Q3) Hibernate SessionFactory/Session cannot be configured using JNDI. a) True b) False Q4) Which of the following Hibernate APIs are NOT a part of the core Hibernate API? a) Session b) Interceptor c) UserType d) Configuration Q5) Which of the following is also called the ‘persistence manager’? a) SessionFactory b) SessionFactoryImpl c) SessionImpl d) Session e) None of the above Q6) Which of the following caches generated SQL statements? a) Configuration b) SessionFactory c) Session d) Query Q7) Which of the following interfaces allow the persistent object to react to events related to its own persistence lifecycle? a) Lifecycle b) Criteria c) Configuration d) None of the above
Q8) for the above SessionFactory configuration the mapping file is: a) Item.class.xml
b) Item.hib.xml c) Item.hbm.xml d) Item.class.hbm.xml Q9) Which of the following are valid hibernate properties (.properties and .xml file)? a) hibernate.connection.driver_class b) dialect c) hibernate.query_class d) All the above Q10) Developer must implement the Serializable interface for all POJOs to be used by Hibernate. a) True b) False Q11) Which of the following statements are true? a) Hibernate would throw a MappingException since there is no type attribute. b) Hibernate would continue processing assuming String/varchar type for the column. c) Hibernate would use reflection on the POJO for the mapping file and determine the type accordingly. d) Hibernate would query the table metadata to determine the type of the column.
Q12) The value of column NAME is never persisted to the database by Hibernate. a) True b) False Q13) Pick a) b) c) d) e)
the odd one out in the following list native, string, identity, sequence, increment.
Q14) Which of the following is true about hibernate a) A <joined-subclass> element may contain other <joined-subclass> elements b) A <joined-subclass> element may contain <subclass> element c) A <subclass> element may contain <subclass> element d) All the above
Q15) elements when the parent is deleted. a) True b) False
will tell Hibernate to delete all child
Q16) Session.get() will throw exception when data is not found in the DB. a) True b) False Q17) Mark the correct answers/s. Session.evict() has the following effect: a) delete the row from the database b) delete the entry from the cache c) both the above Q18) Hibernate cannot explicitly set the database isolation level a) true b) False Q19) Flush mode for a particular transaction is set to FlushMode.NEVER. Which of the following is true a) Hibernate flushes will occur automatically when the transaction ends b) Hibernate will flush if the objects in the memory effects the next query to be executed in that same transaction c) The application has to call flush explicitly to flush changes from memory to DB. Q20) Hibernate POJOs cannot be used by along side CMP Entity Beans. a) true b) false