-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Object Not gettting persisted using Struts
PostPosted: Sun Apr 04, 2010 6:00 am 
Newbie

Joined: Sun Apr 04, 2010 5:45 am
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.