-->
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.  [ 2 posts ] 
Author Message
 Post subject: hibernate does not save data
PostPosted: Tue Dec 01, 2009 7:54 am 
Newbie

Joined: Thu Nov 26, 2009 2:54 am
Posts: 7
I want to save records in database with this method.
Code:
public void save(LookupTablePojo obj) {
      try {
         
         System.out.println("---ID before: "+obj.getId()+" ----- ");
         getHibernateTemplate().save(obj);
         System.out.println("---ID after: "+obj.getId()+" ----- ");
         
      } catch (RuntimeException re) {
         throw re;
      }
   }


When I execute this method through application it gives me this output and the hibernate sql is also printed as follows

Code:
---ID before: null -----
Hibernate: insert into alfresco.lookup_table (LOOKUP_KEY, LOOKUP_VALUE, ID) valu
es (?, ?, ?)
---ID after: 5 -----


It means that it is saving the records properly, but the records are not actually getting saved in database. what could be the problem.

I also tried being and commit transaction but that too does not work...

Plz suggest some fix

thanks


Top
 Profile  
 
 Post subject: Re: hibernate does not save data
PostPosted: Tue Dec 01, 2009 9:05 am 
Regular
Regular

Joined: Mon Aug 07, 2006 5:07 am
Posts: 56
Did you try to do a session.flush() already, and see if any Exceptions come out of there?


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

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.