Session Factory
Session
- Session Factory is a heavy weight object, because it need to read the mapping file, configuration file and other configuration file to create one session factory object.that why we call it as heavy weight object.
- Session Factory is a thread safe object, no two threads access simultaneously and session factory object will be one per application.
- Session Factory is a factory which is going to create a no of session objects which are light weight.
- Session Factory is responsible for creating and managing the session objects.
- Session Factory object will be created one per application and it will be
Session
- Session is a light weight object and not thread safe. i.e it can access multiple thread simultaneously.
- Session object is used to interact with the data base to perform CRUD(Create, Read, Update, Delete) Operations.
- Session is one per request and it will hold the data base connection when we call the CRUD operation, we call it as lazy initializing.
Session session=sessionFactory.openSession();
No comments:
Post a Comment