Sie sind auf Seite 1von 4

Hibernate Test

25 Objective questions
Each question carries 1 mark
5 Subjective questions
Each subjective question carries 5 marks

1. What is hibernate dialect.
____________________________________________________________________________

2. Which annotation is used for table mapping
a) @Table
b) @Column
c) @Id
d) None

3. In hibernate database configuration is done by
a) Hibernate.cfg.xml
b) Hibernate.properties
c) Programatically
d) All

4. In hibernate which tag is used to add mapping file to configuration file.
a) <mapping resource>
b) <mapping class>
c) <property name>
d) None

5. Hibernate SessionFactory is immutable
a) TRUE
b) FALSE

6. In hibernate which tag is used to add mapped annotation to configuration file.
a) <mapping resource>
b) <mapping class>
c) <property name>
d) None

7. Which hibernate method is used to find pojo instance .
a) Search()
b) Substr()
c) get()
d) load()

8. which method throws the exception if no instance is available
a) get()
b) load()
c) substr()
d) search()


9. Which are the states of the life cycle of hibernate
a) New
b) Alive
c) Persistent
d) Removed
e) Detatched

10. Hibernate can be used in ejb application
a) TRUE
b) FALSE

11. Hibernate is suitable in which layer ?
a) Presentation Layer
b) Domain Layer
c) Persistence Layer
d) Both B&C
e) Both A&C

12. What are the features of Hibernate?
a) mapping from Java Classes to the database tables
b) Provides data queries and retrieval facilities.
c) Platform Independent Persistent
d) Both A&B


13. Which is the root level element in Hibernate mapping file?
a) <property>
b) <hibernate-mapping>
c) <hibernate-config>
d) <mapping>
e) Only B E

14. All the methods of the Session interface in hibernate correlated to an event
a) FALSE
b) TRUE

15. List out the XML files that are used in hibernate Architecture
1. ejb-jar.xml
2. hibernate.cfg.xml
3. *.hbm.xml
4. Only B
5. Both B&C
16. Hibernate.cfg.xml file contains
a. information about Driver Class Name
b. Information about Dialect
c. information about Object/Classes
d. Information about properties
e. Both A&B

17. Which package is required to write and execute the Hibernate Application?
a. org.hibernate
b. org.struts
c. javax.sql
d. javax.naming
e. All

18. Which annotation is used for column mapping?
e) @Table
f) @Column
g) @Id
h) None

19. Hibernate is by default supported in which server.
a)Tomcat
b)weblogic
c)Jboss
d)Glassfish

20. Which are hibernate id generator
a)Native
b)Increment
c)Both a & b
d) None

21. Session Factory is thread safe.
a)True
b)False

22. Session Factory is used for creating
a)Session
b)Configuration
c) Both
d) None

24. Hibernate is database independent?
a)TRUE
b)FALSE



25. Various ORM Technologies are
a) TopLink
b) Java Transaction Architecture(JTA)
c) Java Persistent Architecture(JPA)
d) Spring
e) Both A&C



Subjective

Q1. Define the hibernate architecture.
Q2. Create one CRUD application in Hibernate for Customer class with attribute cid, cname, amount .
Use DAO.
Q3. Write a java program as follows:
Accept the empno from the user.
Write a method update which takes the empno as a parameter.
Displays the current salary and updates the salary enterd by user.
If employee with the empno does not exits display appropriate message
to user.(Use the emp table given below)
Q4.Describe different hibernate id generator.
Q5.Create a hibernate application with dao.Create named query to get all records from given emp table.

create table emp
( EMPNO NOT NULL NUMBER(4),
ENAME VARCHAR2(10) ,
JOB VARCHAR2(9),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7,2),
COMM NUMBER(7,2),
DEPTNO NUMBER(2)
);

Das könnte Ihnen auch gefallen