I am able to get a connection to the postgres database as well. But when I execute the main class (SaveDemo.java), the values are not being inserted into the db. Also I am not getting any errors or exception for the same.
Once again stuck up with a small issue.But I am not able to figure it out. In the previously mentioned code snippet, when the control invokes the below line of code, the control is directly moving to the session.close() method of the finally block :
As you didn't post the code of your program, we cannot know whats in line 53. I think it is "session.close()" which is inside a finally block. Something went wrong opening the connection, a runtime exception occured which you re-throw. After that the finally-block is being processed where the NPE occurs because the session is null. But as you didn't post the stacktrace of the exception we cannot know, what happened exactly. There MUST be a stacktrace. You could print it right before re-throwing the RuntimeException.