-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: MyThread app Unable to read data frm db saved by other app.
PostPosted: Tue Mar 27, 2007 9:42 am 
Newbie

Joined: Mon Mar 26, 2007 10:17 am
Posts: 1
Hi,

I am facing some interesting problem with hibernate in my application.

i have two applications in my project; 1. java application 2. web-application(struts) and i have used hibernate in both of them to communicate to the database and both has individual hibernate session factories.

I insert the records into the database using my web-application and i read and display the records from db using my java application and here, my java application is a Timer task one, scheduled to run every 10 seconds.

when i start my java application for the first time, it works fine. it reads the records and display well. but if i insert some more records thru my web-application then my java app is not able to read them. it is returning zero result set. but, when i stop and run my java app then it is able to pick the latest records from db.

In brief, my java application is not seeing the refreshed result set after very addition the web application makes.

i disabled the hibernate's second-level cache also.

i would be thankful if someone can help me out in resolving this issue.

and pls let me know, if i have missed any setting with my hibernate usage.

TIA
-Shariff.


Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.x

Mapping documents:

Code between sessionFactory.openSession() and session.close():
Query query = session.createQuery("select pubQ from PmPublisherQueue as pubQ where pubQ.PmStatusMaster.StatusCode='"+DownloadConstants.NEW_ENTRY+"'");

List url_List = query.list();
if (url_List != null && url_List.size() >0) {
pubQ = (PmPublisherQueue)url_List.get(0);
}
// after session.close();
return pubQ;

Full stack trace of any exception that occurs:

Name and version of the database you are using:
MySQL 5.0

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject: commit?
PostPosted: Tue Mar 27, 2007 9:57 am 
Regular
Regular

Joined: Wed Aug 24, 2005 11:49 am
Posts: 63
Are you committing transactions?

_________________
Edwin van der Elst
Finalist IT Group


Top
 Profile  
 
 Post subject: Same issue faced
PostPosted: Tue Mar 27, 2007 12:11 pm 
Newbie

Joined: Tue Mar 27, 2007 12:03 pm
Posts: 1
Location: india
try the following options:
1. refresh the querycache
2. flush the session
3. if result set is empty, try to shoot the query again after doing the above two.

thanks.

_________________
-- Nothing is ImPoSsIbLe


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.