Featured Post

NoSQL use cases

Here are a simple summary of use cases for Cassandra, MongoDB and Redis MongoDB Storing Log Data Speed is the primary perfor...

Tuesday, September 11, 2012

Hibernate Session vs SessionFactory

In Hibernate there are two important classes to know:

Session is not thread safe

Session it is not implemented to be thread safe.
In a multi-thread environment each thread/transaction should obtain its own instance of Session from a SessionFactory.
See Session API.

SessionFactory is thread safe

SessionFactory is immutable. Once the session has created its state it's set for all the life time.
See Session Factory API.

Immutable Objects

For more information about Immutable Object see Immutable Object

No comments :

Post a Comment