pearlkumar wrote:
session.getTransaction().rollback();
System.out.println(" last inserted id"+user.getId()); // from user class.
It must have something to do with your database. IDs can not be rolled back since most of them are sequential. So lets say you use n and you want to revert back. However, n+1...n+m might have been used in this while and it is not a trivial task to put n in queue for the next id generation and make sure the one after n is n+m+1. You will have to implement your own id generation mechanism if you want this to work but it will be quite complicated. That's what I think though.
Farzad-