This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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

Not able to Fetch Latest Records from Table

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am facing problem with Hibernate, while fetching the records from table.

Let me explain the problem first and later I will post my code.
Problem: I have written code to fetch the total number of records exists in a table.
So first time when I execute the Class it was returning 4 entries in the table, i.e correct
Next I am Inserting one row to the Table from back end (means using SQLYog I am inserting one row to the Table).
When I execute the same class Now also its returning 4 entries. where it should have to return 5.

I am Not able to get the latest records from the table which I inserted manually to the table.

hibernate.cfg.xml



JAVACode:


Please Help me in this Issue......
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you insert your record do you commit the transaction?
 
vijay sachin
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

Thanks for the reply.

I am inserting record to the table from back end (Using SQLYOG Tool), by typing insert statement.
Not from java code....
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. Do you commit your transaction after thin insert?
 
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if your table definitely has 5 records & hibernate is showing 4, then hibernate is only loading 4 entries (pretty obvious).. please check the generated SQL to findout if there are any specific conditions associated for the mapping file (probably at class level).

 
You don't like waffles? Well, do you like this 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!