openSession--> If we use this method, we need to flush() and close() the session. It does not flush and close() automatically. We can use this method when we decided to manage the Session our self.
getCurrentSession--> A session is opened whenever getCurrentSession() is called for the first time and closed when the transaction ends. This creates a brand new session if one does not exist or uses an existing one if one already exists. It automatically configured with both auto-flush and auto-close attributes as true means Session will be automatically flushed and closed.
We can use getCurrentSession() method when our transaction runs long time.
getCurrentSession is usually sufficient. openSession provides and facilitates a greater level of management of where the session is stored and managed. It's certainly an advanced option, but one that does indeed fit the need of very clever developers who are doing some nifty things with the session.
Note: Using getCurrentSession() to create the session will automatically terminate at a commit or rollback, and using openSession() to create the session will require manual termination