Difference between session.save() and session.saveOrUpdate()

Q) Difference between session.save() and session.saveOrUpdate()?
A)

session.save() – Insert data into the table
session.saveOrUpdate()- Insert data if primary key not exist otherwise update

Explain session destroy in Servlets

Question: How you can destroy the session in Servlet?
Answer:
You can call invalidate() method on the session object to destroy the session. e.g. session.invalidate();

Explain Session tracking using Servlet

Question: How to track a user session in Servlets?
Answer:
The interface HttpSession can be used to track the session in the Servlet. Following code can be used to create session object in the Servlet: HttpSession session = req.getSession(true);

Define Session Migration

Question: What is Session Migration?
Answer:
Session Migration is a mechanism of moving the session from one server to another in case of server failure. Session Migration can be implemented by:
a) Persisting the session into database
b) Storing the session in-memory on multiple servers.