REGISTER FREE to Receive Instant Job

Saturday, 6 December 2014

Hibernate Interview Questions

1- What is hibernate?
Hibernate is an ORM framework. Object Relational Mapping is a technique to map data of Object Domain into data of Relational Domain. In each Application, Application developers need to persist data into databases and need to fetch persistent data from databases. Java provides JDBC API for this task.
2-What is ORM?
Object Relational Mapping (ORM) is a technique transforming data one representation to another. Some of the benefits of ORM and Hibernate.
3- Explain hibernate architecture?

Hibernate Architecture divided in Four-layers of Java Application layer, Persistence Object layer, Hibernate Framework layer and Existing Java API’s. Let’s see the diagram of Hibernate Architecture…

4-What is SessionFactory?

SessionFactory provides the instance of Session. It is a factory of Session. It holds the data of second level cache that is not enabled by default.
5-Is Session a thread-safe object?

No, Session is not a thread-safe object, many threads can't access it simultaneously. In other words, you cannot share it between threads.
6- What are the states of object in hibernate?

There are 3 states of object (instance) in hibernate.

  • Transient: The object is in transient state if it is just created but has no primary key (identifier) and not associated with session.
  • Persistent: The object is in persistent state if session is open, and you just saved the instance in the database or retrieved the instance from the database.
  • Detached: The object is in detached state if session is closed. After detached state, object comes to persistent state if you call lock() or update() method.

7-What are the inheritance mapping strategies?
There are 3 ways of inheritance mapping in hibernate.

  • Table per hierarchy
  • Table per concrete class
  • Table per subclass

8-How to make a immutable class in hibernate?

If you mark a class as mutable="false", class will be treated as an immutable class. By default, it is mutable="true".
9-How many types of association mapping are possible in hibernate?
There can be 4 types of association mapping in hibernate.

  • One to One
  • One to Many
  • Many to One
  • Many to Many

10-What is lazy loading in hibernate?

Lazy loading in hibernate improves the performance. It loads the child objects on demand.

Since Hibernate 3, lazy loading is enabled by default, you don't need to do lazy="true". It means not to load the child objects when parent is loaded.

8 comments:

  1. Thanks for sharing such informative guide on .Net technology. This post gives me detailed information about the .net technology. I am working as trainer in leading IT training academy offering Dot Net Training in Chennai and i use your guide to educate my students. .Net Training in Chennai

    ReplyDelete
  2. Spring is an open source framework which is mainly used in java applications that can be deployed in standalone platform.
    spring training in chennai | spring course in chennai

    ReplyDelete
  3. nice! thank you so much! Thank you for sharing. Your blog posts are more interesting and impressive. I think there are many people like and visit it regularly, including me.
    192.168.1.1

    ReplyDelete
  4. Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more .
    java training in chennai

    ReplyDelete



  5. The blog or and best that is extremely useful to keep I can share the ideas
    of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.
    tanki online | 2048 game|

    ReplyDelete

Popular Posts

Powered by Blogger.

About Me

My photo

JobsAcid is a 'job search engine' to provide finding a job on the internet easier for the user. It has designed as huge selection of job offerings on the same search engine.