Expensive to create, typically one per application
Holds second-level cache data
Configuration is read-only after creation
Session:
Interface between Java application and Hibernate
Not thread-safe
Lightweight and inexpensive to create
Represents a single unit of work
Should be created and closed for each transaction
// SessionFactory - created once
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
// Session - created per transaction
Session session = sessionFactory.openSession();
// ... perform operations
session.close();
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.