session.open
insertIntoTODB()
getList()
session.close
session.open()
getList();
sesson.close()
1st leve cache is only bounded in session open and close and for 2nd subsequent session open, getList() will get from DB instead of cache?
session.open
insertIntoTODB()
getList()
session.close
session.open()
getList();
sesson.close()
1st leve cache is only bounded in session open and close and for 2nd subsequent session open, getList() will get from DB instead of cache?
Yes. The 1st level cache is for the session only. The second getList() call will go to the database.
EDIT: The second getList() call will go to the database, in the absence of the second level cache, as well noted by mR_fr0g in his answer.
The first level cache is session scope. The second getList() will go to the database only in the absence of a second level cache. Second level caches are session factory scoped.