[EoDsql-users] Very basic question about DataSet and models
Status: Beta
Brought to you by:
lemnik
|
From: Ricardo P. <rpm...@ya...> - 2007-04-20 20:34:42
|
Hi, I must start admitting that I'm still a bit newbie with Java and, specially, with DB access, so this can be a stupid question; anybody feel free to kick me. :-) OK, so I've already got a "Product" POJO with a ProductQuery interface extending BaseQuery and containing some pretty basic queries and inserts/updates. Now I want to prepare a basic CRUD (Create, Retrieve, Update and Delete) management GUI, and for that I will have a JList with elements that, when selected, will allow view & edit the details on text fields next to it. The JList needs a model, and I plan to use an auxiliary class extending AbstractListModel and implementing other interfaces as needed, like MutableComboBoxModel. What I'm trying to find out is: - can the DataSet<Product> returned by "SELECT * FROM Product" query be used as the actual list of records in memory? I would run the query and disconnect() the DataSet to get all records (this will actually be a pretty short list, five or ten elements at most). - if the above is possible, how could I best deal with insertions, updates and deletes? Would it be sensible to just run the insert/update/delete query and then just nullify the DataSet and rerun the query to get it again with the most current data in DB? I've seen examples using JDBCRowset for more or less what I want to do, but I think DataSet is intended to provide the same or more functionality than JDBCRowSet. Am I wrong and should I base my model on JDBRowSet? TIA |