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
@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);
}
}