• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to Fetch Latest Records from Table

 
vijay sachin
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......
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate 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
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. Do you commit your transaction after thin insert?
 
Anantha Sharma
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).

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic