0

I need some advice on the way I'm should be doing something like this...

My main GUI is composed of a JTable and query box for custom SQL user queries.
I execute a SQL query, from the ResultSet, map the ResultSet an ArrayList<Object>, parse it to a tableModel class extends AbstractTableModel and display it in a JTable and hope it work.

I was told by teacher that it's also a good idea to say make a class for each table to hold the data types and map ResultsSets to that table class... I didn't quite understand and is confused. I'm not sure what it really means but I can map classes for each table to store data, but I get the resultset = statement.executeQuery(...), how am I supposed to use those classes that represent each table? ...

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by rugae
0

have you learned anything at all?
Your teacher told you exactly what to do, any more detailed and he'd have had to write the code for you.

0

It's not that I don't know how to write classes but how to use them.

I can have data classes for each table with setters and getters but when you run a SQL query you make the connection and execute the query from the statement to get the ResultSet. How am I suppose to use the classes that represent the table? Or is there a way to run the query against the classes or something and get results somehow from that?

Another problem is inorder to make the object/class for each table, you'll have to know it's expected types when making such class from the ResultSet. So if a class have a name (String), age (int) you would call .getString(..) and getInt(..() to make the class... But if there's a custom query how am I suppose to map to a already defined class now...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.