Are there any frameworks for handling database requests in swing applications?

By : dhiller
Source: Stackoverflow.com
Question!

I believe any programmer who has been dealing with database requests in a gui application has run into some or all of the following problems:

  • Your GUI freezes because you call database layer from within the event dispatch thread
  • When you have multiple windows/panels/jframes where user can start a db request your performance degrades because you don't have any control about the threads your user creates
  • User may be able to lock down the application and even the database because he calls any action many times before the first action has been finished

What I'd like to know about: are there any frameworks that handle the requirements of handling an ordered set of long running actions (including but not limited to database calls, i.e. calculations) outside the event dispatch thread?

Note: I know of SwingWorker ;-)

By : dhiller


Answers

Naked Objects facilitate a clean domain model and they also have a GUI 2 DB mapping layer -- http://www.nakedobjects.org/home/index.shtml

By : anjanb


Such a thing should be found in Netbeans for example. See RequestProcessor. But in simpler cases this is not required. Last time I need something like thread scheduling and control I simply used new concurrency packages included in J5 (I used J6). With its ExecutorFactory-ies you can simply achieve basic control over tasks. You can also use some queues. This PDF can help. The PDF is written in Slovak language but the Single/Multiple task workers are there written in Java ;)



I doubt you will find something specific for database requests. You can try to reuse existing generic task scheduling libraries. An example is the Eclipse jobs API. This does not depend on the IDE.

See http://www.eclipse.org/articles/Article-Concurrency/jobs-api.html

By : Tom


This video can help you solving your question :)
By: admin