From the course: Java Database Access with Hibernate
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Sessions explained - Java Tutorial
From the course: Java Database Access with Hibernate
Sessions explained
- (Instructor) One of the key components to using hibernate is sessions. Sessions are used to establish a connection to the database. Let's take a look at sessions explained. - Core classes from the hibernate framework are used to establish a connection to the database and manage the interactions that occur. To maintain data integrity, it's really important to only open a connection when needed and then to close the connection as soon as possible. Usually an application has a single SessionFactory instance and threads service and client requests obtain session instances from this factory. A configuration object is used to create a SessionFactory object, which in turn configures hibernate for the application using the supplied configuration file and allows for a session object to be instantiated. The SessionFactory is a thread safe object and used by all the threads of an application. It is considered a heavyweight object. So, usually it is created during the application start-up…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.