Session Object in Hibernate

1. Session is the “first level cache” of persistent objects.

2. Session is not thread-safe – do not share session object across threads

3. Session is light-weight. you may create it and destroy it after every logical “unit-of-work”.

4. Session can be stored in a HTTPSession object. Its the ideal place to store the session object during user “think-time” or when user is making a decision on the screen.

5. Session.save(obj) converts an object from transient to persistent state and session.flush() synchronizes the state of the object with the database.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: