It is a heavyweight object, because it maintains data sources, mappings, hibernate configuration information etc.
Sessionfactory will create and manage the sessions.
If you have say, 4 datasources/databases, then you must create 4 session factory instances.
sessionfactory is an immutable object and it will be created as a singleton while the server initializes itself.
Session:
It is one instance per client/thread/one transaction.
It is not thread-safe.
It is lightweight.
sessions will be opened using sessionfactory.openSession() and some database operations will be done finally session will be closed using session.close().