This week's book giveaway is in the Go forum.
We're giving away four copies of Head First Go and have Jay McGavren on-line!
See this thread for details.
Win a copy of Head First Go this week in the Go 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

How to get the changing value from the database table?  RSS feed

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this SQL query which is used in the code below.



Different values of STATUS are NOT STARTED, RUNNING, COMPLETE, ERROR.

I need to keep checking the value of STATUS from time to time and do some operations as soon as I find `COMPLETE` and wondering what approach I should following to achieve my task. Any ideas in which direction I could proceed?

Right now, in the code below, I only see NOT STARTED and my code exits.And I am not sure how to make the code figure out and let me know when  it is going to change to COMPLETE so that I could perform some operations on it. Because, in the database table it could take a while(hrs) to change it to COMPLETE.

Let's say I have the following controller,DAO and DAoImple to get the STATUS


Controller:



Data Access Object(DAO):



DAO Impl:



Let me know if I can answer any questions.
 
Marshal
Posts: 24199
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Shouldn't that method return the status as a String value? Writing the status to System.out seems pointless to me.
 
Ranch Hand
Posts: 277
2
Fedora Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a reason you have to look at the status in the db?  Is the status being changed from another app or what?  
If you have to get the value from the db, then i guess youd have to keep checking.  
 
Jack Tauson
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Shouldn't that method return the status as a String value? Writing the status to System.out seems pointless to me.



Thanks Paul for looking into this. I abandoned this approach. Basically I am now sending the uniqueId to JMS Queue whenever an Ajax call comes in. This is in one springboot app (publisher related). In my another Spring boot app(consumer related), I am planning to consume this uniqueId and keep on checking the status. In this way, I won't have to deal with both the things in a single app.
 
Jack Tauson
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Al Hobbs wrote:Is there a reason you have to look at the status in the db?  Is the status being changed from another app or what?  
If you have to get the value from the db, then i guess youd have to keep checking.  



This approach was not getting me desired results and hence I decided to use JMS (I always intended to use it at some point) as explained above. Thanks for looking into this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!