Differences between session vs session factory - Hibernate?

后端 未结 7 1645
予麋鹿
予麋鹿 2021-01-31 10:35

Do we have any other differences other than the below? Also please validate whether the below are correct

  1. SessionFactory objects are one per applicati
7条回答
  •  滥情空心
    2021-01-31 11:19

    SessionFactory is a factory class for Session objects. It is available for the whole application while a Session is only available for particular transaction.

    Session is short-lived while SessionFactory objects are long-lived. SessionFactory provides a second level cache and Session provides a first level cache.

提交回复
热议问题