Hi,
I am using hibernate to persist data in a small web application which is based on struts framework. This application is running on Apache Tomcat server. In the event logs, there is no error thrown and object is getting persisted correctly. However, no records are getting updated when check in database. Even older records are getting deleted.
Here is the code segment to persist data:
Code:
Release release = new Release();
release.setProduct(product);
release.setComponent(component);
release.setPatchName(patchName);
release.setProject(projectId);
release.setStatus(0);
release.setReleasedOn(new Date());
release.setReleaseType(releaseType);
release.setId(10);
try{
session = HibernateUtil.getSession();
if(session.isOpen()){
session.beginTransaction();
System.out.println("Session opened");
session.save(release);
session.getTransaction().commit();
System.out.println("Record inserted successfully");
}
There are no exception thrown and I even get "Record inserted successfully" message in the console.
However,same piece of code works fine when run as a standalone java code instead of running it as a web application.
Kindly help me out.