• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Not able to Fetch Latest Records from Table

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).

 
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic