Hi,
Is it possible to return a ResultSet from a model class? My code isn't working correctly, and I am unable to find any documentation online to see if this is possible. I would have thought it would have been since it is just another object, so im guessing my syntax is incorrect.
Servlet that calls the model class (all correct import statements are at top of file, not shown in code below)
Code in the model class
When I try to compile I get the following error
"Cannot find symbol"
"Symbol: variable results"
( ie, line 43. )
My guess is that the reason it is throwing an error is due to the results variable being declared within a try/catch block (which could potentially fail).
Although since the ResultSet class is abstract it cannot be created like "ResultSet results = new ResultsSet();" so I am unsure how to fix this issue.
Any ideas?
The point of this model class is as the name suggests, to pull a set of results from the DB to the main servlet class so I can do some looping through the results, then in future so I can easily select data from the DB using this class and likely do similar things.
If this is not possible I guess I will have to create a new method to actually do the work I require but it is a bit sloppy code since there is a lot of duplication.
Any help appreciated.
Thanks
Michael