mercredi 20 mai 2015

How to Process ResultSets the right way?

Wich is the right way to process the ResultSet in Java from a Sqlite Database?

At the moment i have a "SQL" class wich does all the SQL Queries.

If another class needs some Data it calls a method of the SQL class, the SQL class gets the ResultSet stores it in a Array or something else and returns the array.

But thats kinda stupid and i know that's for sure not the right way.

So how do i get the Data of the ResultSet into my other classes without using such a nasty mehtod?

The point where I struggle ist that the ResultSet is closed as soon as the Statement gets closed so i cant return the ResultSet.

Im pretty sure i have a really big conceptional problem but i dont know how to solve it.

Aucun commentaire:

Enregistrer un commentaire