| | |
add a query add a list
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2007
Posts: 239
Reputation:
Solved Threads: 0
How can I create a new query and a new List to hold a resultset?
I have tried by using the follong code in the class below
I have tried by using the follong code in the class below
Java Syntax (Toggle Plain Text)
@Action public Task search() { return new SearchTask(getApplication()); } private class SearchTask extends Task { private String searchQuery; private List searchList; SearchTask(org.jdesktop.application.Application app) { super(app); searchList = org.jdesktop.observablecollections.ObservableCollections.observableList(query.getResultList()); } //public <PropertyType> get<PropertyName>(); @Override protected Void doInBackground() { try { setProgress(0, 0, 4); setMessage("Rolling back the current changes..."); setProgress(1, 0, 4); entityManager.getTransaction().rollback(); Thread.sleep(1000L); // remove for real app setProgress(2, 0, 4); setMessage("Starting a new transaction..."); entityManager.getTransaction().begin(); Thread.sleep(500L); // remove for real app setProgress(3, 0, 4); setMessage("Fetching new data..."); java.util.Collection data = query.getResultList(); Thread.sleep(1300L); // remove for real app setProgress(4, 0, 4); Thread.sleep(150L); // remove for real app list.clear(); list.addAll(data); } catch(InterruptedException ignore) { } return null; } @Override protected void finished() { setMessage("Done."); setSaveNeeded(false); } }
![]() |
Similar Threads
- Need help with n-tier looping (ColdFusion)
- SELECT query only of jobids with tagids from all catids (MS SQL)
- query with combo box input (MS Access and FileMaker Pro)
- SQL search query (PHP)
- Link list Query (C)
- How do add a blank choice to dropdownlist (VB.NET)
- I've got Trojan.Holax... is this bad? (Viruses, Spyware and other Nasties)
- not-a-virusadware (Viruses, Spyware and other Nasties)
- How to list the record orderby id when selecting distinct (Visual Basic 4 / 5 / 6)
Other Threads in the Java Forum
- Previous Thread: Help needed for saving high scores
- Next Thread: search and display
| Thread Tools | Search this Thread |
actuate android api applet application applications array arrays automation balls bank binary bluetooth business chat class classes clear client code codesnippet collections component database db defaultmethod development dice draw ebook eclipse error event exception formatingtextintooltipjava fractal game givemetehcodez graphics gui hql html ide image infinite input integer invokingapacheantprogrammatically j2me java javaprojects jni jpanel julia linux list loop looping map method methods mobile mysql netbeans newbie numbers openjavafx oracle parameter php print problem program programming project recursion repositories scanner screen scrollbar server set size sms sort sorting sql sqlserver state storm string sun superclass swing swt text-file threads time tree windows





