Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to get the changing value from the database table?

 
Ranch Hand
Posts: 221
  • 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: 25682
69
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.
 
Rancher
Posts: 527
6
IntelliJ IDE Spring Fedora
  • 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: 221
  • 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: 221
  • 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.
 
Seriously? That's what you're going with? I prefer this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic