Hibernate Quiz
Hibernate Quiz - 2

« 1 2 3 »

1. The interfaces used in hibernate are :
a) Session
b) Transaction
c) SessionFactory
d) All of the above

2. The root element of hibernate.cfg.xml file is
a) <hibernate>
b) <hibernate-configuration>
c) <hibernate-session>
d) <hibernate-mapping>
Wrong! Try again

Wrong!
The correct answer is b) <hibernate-configuration>
Correct!
<hibernate-configuration>

3. Which of following is true?
a) We cannot connect to two different databases in hibernate.
b) A session object is thread safe.
c) We can create two session objects from same SessionFactory.
d) None of the above
Wrong! Try again..
Wrong!
The correct answer is c) We can create two session objects from same SessionFactory .
Correct!
We can create two session objects from same SessionFactory


4. An object emp can be saved to database using method save(emp) of following :
a) Transaction
b) Configuration
c) SessionFactory
d) Session

Wrong! Try again.
Wrong!
The correct answer is d) Session. Session.save() is used to save a persistant instance
Correct!
Session.save() is used to save a persistant instance

5. Which of the following is a tag NOT used in hibernate.cfg.xml ?
a) <property>
b) <hbm2ddl.auto>
c) <session-factory>
d) <mapping>

Wrong! Try again.
Wrong!
The correct answer is b) <hbm2ddl.auto> is not a tag, but a property
Correct!
<hbm2ddl.auto> is not a tag, but a property

6. What is true for session.get() method?
a) Will return null if there is no data in db or cache.
b) Will throw exception if there is no data in db or cache
c) may return a lazily initiliazed proxy
d) None of the above
<--Previous Next-->