INDEX
Hibernate, Spring and Struts Interview Questions
Hibernate
Hibernate Interfaces
1: Explain Database Transaction management using Transaction Interface.
2: What are the core interfaces available in hibernate?
3: What is SessionFactory? Is it thread-safe object?
4: How will you create SessionFactory object?
5: What is Session? Is it a thread safe object?
6: Explain about Criteria in hibernate.
Hibernate Configuration
7: How do you configure hibernate?
8: What are the important tags of hibernate configuration file (hibernate.cfg.xml)?
9: Why column attribute is required if the property name is “date”?
10: How will you get hibernate statistics?
11: How will you make generated sql to be displayed in console?
12: How are the columns of the database mapped with the java class properties in hibernate?
13: If you want to insert data for few columns into a large table with hundreds of columns, hibernate will generate the insert sql query at run time containing all the table columns which will create performance issue. How will you make the hibernate to generate dynamically generated sql queries containing only the necessary columns? For instance, it should not include the null columns / property values.
14: What is the flow of hibernate communication with database?
15: How will you configure Sequence generated primary key?
16: How will you change one relational database to another database without code changes?
17: What is dynamic-insert and dynamic-update option in the class mapping?
18: How will you configure Hibernate to access the instance variables directly without using setter method?
19: What is Automatic Dirty checking in hibernate?
20: Write down a sample code for Automatic Dirty checking.
21: How hibernate is database independent and what are the changes required?
22: How will you include hibernate mapping file in the hibernate configuration file?
Criteria Queries
23: What are the ways in which object can be fetched from the database in hibernate?
24: What is the use of Restrictions class?
25: How will you write criteria query to retrieve records having dept_name containing “hr” and emp_salary between 20000 and 30000?
26: How will you sort the employee class in descending order by employee salary using Criteria query?
27: How will you find out the maximum salary from Employee class?
28: What are the methods available in Projections class?
29: How will you implement pagination using criteria query?
30: What are the disadvantages of Criteria query?
31: How is the Primary Key created using Hibernate?
32: How do you create hibernate generated Primary Key?
Persistent Classes
33: What are Tuplizers?
34: Why can’t we declare a Hibernate persistent class as final?
35: What are the best practices that we need to follow while creating Persistent class?
36: How will hibernate instantiate the persistent classes?
37: What are the functionalities available for the POJO classes which declare identifier property?
38: What are the methods to be overridden in POJO?
39: What is meant by Named SQL query?
40: How will you invoke Stored Procedures?
Object States
41: What is the difference between the Transient and Detached states?
42: What are the types of instance/object states?
43: When does an object come to detached state?
44: How would you ...