hai,
i have doubt in rollback concept.pls clear my doubt.
first i saved the data in the session, then i rollback again, sothat the data are not stored permenently in the database. its workking fine.
but my question is the data are not rollback in the class ie(User class).
when i print the last inserted id from the class, it print last inserted id, but that id not present in the database. bcz it already rollback. so how to rollback in the class also
see the code for clear description
User user = new User();
user.setFirstname((String)addContactForm.getFirstname());
user.setLastname((String)addContactForm.getLastname());
user.setEmail((String)addContactForm.getEmail());
session.save(user);
session.getTransaction().rollback();
System.out.println(" last inserted id"+user.getId()); // from user class.
|