Skip to main content

Posts

Showing posts from January, 2015

11 - JPA/Hibernate Interview Questions

Why Hibernate? Answer : In Short it helps you solve some problem which indirectly comes when you are using JDBC 1. Help you to avoid lots of boilerplate code. 2. Helps you to avoid doing any Connection Management and Transaction Management explicitly. 3. Helps you DB Developer to do exciting things rather than helping the Junior or Mid Level engineer for writing native query. 4. It creates two way data binding between your table and POJO i.e. any change in POJOs's reflects in db table and any changes in db table reflects in application POJO, i.e. objectifies the data layer. 5. Future Proof : Very minimal effort needed to migrate the one database type to another. 6. When you want to do lot of business operation on your POJO's, and you want those POJO's to be handy. When Not to use Hibernate? Answer : Few points to be seen before introducing the Hibernate into your application 1. If you do not have Persistence Layer, there is no use of Hibernate. 2. Legacy

Java Interview - Part 1

Class and Object and Inheritance Question : What benefits of oops?  Answer : 1. Re usability 2.Inheritance 3. Data Hiding 4.Solution based on real life entity 5. Maintainability 6. Upgradeable. Question : Can you explain oops. Answer : 1. Encapsulation 2. Inheritance 3.Polymorphism 4. Abstraction Question : What is Dynamic polymorphism. Answer : c lass A {  method() } class B extends A{    method() }   class Main{ psvm(){    A a = new B(); //Creating the Instance of child class    a.method() ; //It will call the method from child     } }   Question : What will happen if we delete the method from Class B Answer : Then meth od in class A will be called . Q uestion : If the method from class A is deleted th en wha t will happen? Answer : Compilation error as there is no method in class A.   Question : Is it possible to extend a class which has private constr uctor ? Answer :   No, It canot be as Object creation won't able to fin d the super c