What is different between session and sessionfactory in hibernate? (Detailed answer)
Answer / Manoj Kalyani
Session and SessionFactory are two key components of the Hibernate API:
1. Session: It represents a single open session with the database, managing a single unit of work. Each session is bound to a specific transaction. A session can be used to save, update, delete, or query data in the database.
2. SessionFactory: It manages multiple sessions and configurations for your application. A SessionFactory instance is created once during application startup and shared across all sessions throughout the application's lifetime. The SessionFactory loads mapping metadata and prepares SQL statements to be used by each session as needed.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is a hibernate transaction?
What is a hibernate xml mapping document and how does it look like?
What is transaction boundary in hibernate?
How create hibernate cfg xml?
How to implement joins in hibernate?
What are different states of an entity bean in hybernate?
What is bidirectional flow?
What databases does hibernate support?
What is mapping in hibernate?
What is hbm2ddl in hibernate?
How do I save in hibernate?
What is difference between get and load?