Chapter 2. Understanding the Fundamentals

In this chapter, we will cover the following recipes:

  • Building a SessionFactory
  • Creating a generic SessionFactory provider class
  • Opening a new session
  • Opening a stateless session
  • Saving an object to the database
  • Fetching an object from the database
  • Removing an object from the database
  • Updating an object
  • Creating a criteria
  • Restricting the results using a criteria
  • Pagination using a criteria
  • Sorting the results
  • Transforming a result
  • Using basic projection

Introduction

Before we proceed, it's necessary to learn about the fundamentals of hibernate: the classes and interfaces required.

In this chapter, we will cover the fundamentals of hibernate, such as SessionFactory, Session, and Criteria. We will discuss the importance ...

Get Java Hibernate Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.