• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate SaveOrUpdate

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am new to Hibernate and facing very basic problem and not able to found what's issue in the code ......
I am updating an Employee data using the hibernateTemplate.saveOrupdate method ....but when i m calling get or load method its failing saying no row found ..
I am pasting my Code below ..



Employee class :

EmployeeDao

Thanks,

 
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. You said, you are saving the data, Did you check if it is getting saved successfully or requires you to commit the transaction?
2. Did you actually run a query across the database and check if there are any rows with id "123"?
 
Yogesh Kumar Yadav
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply ...

Yes I did check the database after the save ..I can see the data......However when i m running the code after commenting the saveOrUPdate , just to fetch the
values ...I am getting no rows and same is applicable when i m looking into the database ...

I know the problem is because of commit ...but where I need to put the commit info ??

Thanks for helping
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in the hibernate config file, you can specify this option.

hibernate.connection.autocommit - Enables autocommit for JDBC pooled connections (it is not recommended). e.g. true | false

for more information,

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html
reply
    Bookmark Topic Watch Topic
  • New Topic