
Save my name, email, and website in this browser for the next time I comment. Here in this post coding compiler presenting a list of 75 advanced hibernate interview questions for freshers, 1 year experience, 2 years experience, 3 year experience, 4 year experience, 5 year experience. Your email address will not be published. by Coding Compiler 75 Hibernate Interview Questions And Answers For Experienced.

Please go through java interview programs for more such programs and core java interview questions for more interview questions. Please go to difference between comparator and comparable for differences. What are the advantages of Hibernate over JDBC 3. Hashcode and equals method in java Question 10:ĭifference between Comparator and Comparable in java?Īnswer: This is also one of the most asked java collections interview questions. 20 Hibernate Questions and Answers from Java JEE Interviews 1. Generation 1 This identifies an object which has been marked as collection but not removed. Generation 0 This identifies a newly created object that has been never marked for collection. If we want to sort custom object (Lets say country) on different attributes such as name,population etc.We can implement Comparator interface and can be used for sorting.įor more details,you can go through following links:Īs we did not override equals method here, it will have default implementation which return true if objects point to same reference (=) but here, as we have created two different object as employeeOne and employeeTwo, size of HashSet will be 2 19) What are the types of generations in garbage collector There are three types of generations in garbage collector. It will provides default way of sorting custom objects. We need to implement comparable interface to custom object class(Lets say Country) and then implement compareTo(Object o) method which will be used for sorting.
#HIBERNATE INTERVIEW QUESTIONS FOR 8 YEARS EXPERIENCE HOW TO#
How to sort a collection of custom Objects in Java?compareTo method returns 0, employeeOne is equals to employeeTwo, so employeeTwo will not be added to treeSet.When we will added second element with martin, compareTo method will get called with pareTo(employeeTwo) and it will return 0.

First element with “John” will be added to employeeSet.As you can see we have overridden compareTo method in Employee class and always return 0.
