Spring Server / Client and Hibernation Sessions

I use Spring 3 and Hibernate 3.6 to develop a web application - Im new and Im wondering if I really understand how sessions work.

Is it true that the sessions between the server and the client identified by the session identifier are different from hibernation sessions?

The session between the server and the client is always an HttpSession. (?) When is it created? When a user logs in, or when an anonymous user requests a page (which is not secure)?

Is there any connection between httpsession and hibernate sessions? Hibernate sessions created by a session factory without connecting to httpsession? I'm not sure which hibernate session is referencing a command like this:

this.sessionFactory.getCurrentSession().save(object); 

this getCurrentSession() : how long has this hibernation session been active? all the time the user is logged in? or just for one transaction (which may include several data operations?)

I'm sorry that this question may be easy to answer, but most of the documents are written in English, and if this is not an understanding of the native language, it is sometimes difficult (mainly because the word "session" is used so often)

Thank you for helping me understand this topic! :-)

+4
source share
1 answer

Is it correct that the sessions between the Server and the Client, identified by the session identifier, are different from the hibernation sessions?

Yes, completely different.

Link: (javax.servlet) HttpSession , (Hibernate) Session

The session between the server and the client is always HttpSession. (?) When is this created? When does a user log in or when an anonymous user requests a page (which is not secure)?

See Java EE Tutorial> Serving Client Status

Is there any connection between httpsession and hibernate-sessions?

No, although OpenSessionInViewFilter can guarantee that there is a Hibernate Session for each HTTP request (one hibernation session for each request, not in a web session).

. Hibernation sessions created by sessionfactory without connecting to HttpSession?

Yes, usually.

I'm not sure that session hibernate refers to the run command: "This.sessionFactory.getCurrentSession () save (object);"

Hibernate Session

this "getCurrentSession ()": why is the sleep session active for a long time? for the whole time of user registration in? or in just one transaction (which may include several data operations?)

See Hibernate Reference> Sessions and Transactions

+6
source

Source: https://habr.com/ru/post/1344592/


All Articles