Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Hibernate Cannot insert values

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried for 3 hours can't find a answer , posting it

After running the program printing Inserting Record and Done inserting values , but couldn't find values in db . Any help what to check and where to check ?






Pojo class :

package mine;
// Generated Apr 18, 2009 10:56:39 AM by Hibernate Tools 3.2.1.GA




 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I'm not an Hibernate expert, but there is one very important thing that I think your code is missing:
you're neither beginning, closing a Transaction nor committing your insert. Therefore Hibernate keeps the object you created in its object cache.
Try something like this:



except that you should obviously do your object creating instead of doing a select in lines 6-11

(taken from laliluna)
 
Steve James
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
joe that worked . Thanks
 
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!