XML Configuration hibernate.cfg.xml
Session is a light weight non-threadsafe object
You can share the session between threads
Session represents a single unit-of-work with the database
Session is the primary interface for the persistence service
A session loads database connections using lazy-loading
SQL variant to generate
Size of the database
Query and Criteria interfaces
Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier
Created during application initialization
Wraps a JDBC connection
Act as Factory for Transaction
Create HQL Query
Execute query to get list containing Java objects
Create session from configuration object
Load the Hibernate configuration file and create configuration object
Get one session from the session factory
You must have a default no-argument constructor for your persistent classes and there should be getXXX() (i.e accessor/getter) and setXXX( i.e. mutator/setter) methods for all your persistable instance variables.
You should implement the equals() and hashCode() methods based on your business key and it is important not to use the id field in your equals() and hashCode() definition if the id field is a surrogate key (i.e. Hibernate managed identifier). This is because the Hibernate only generates and sets the field when saving the object.
It is recommended to implement the Serializable interface. This is potentially useful if you want to migrate around a multi-processor cluster.
The persistent class should be final because if it is final then lazy loading can be used by creating proxy objects.