• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Hibernate SaveOrUpdate

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!