Java class that mimics a simple database table

I have a set of heterogeneous data that I am retrieving from a database table table. Then for each unique uv value in column A, I calculate the function (SELECT * FROM mtable WHERE A = uv). Then I do the same for column B and column C. There are quite a few unique values, so I don't want to hit the db multiple times - I would rather have a class that replicates some functionality (most importantly, the SELECT WHERE version). Also, I would like to abstract the column names from the class definition if that makes sense - the constructor should take a list of names as a parameter, and also, I suppose, a list of types (right now it's just String [], which seems to be a hack). I am getting raw data from RowSet.
I have more or less done this using a hashmap that maps strings to lists / arrays of objects, but I get stuck in comparisons and types all the time and think my current implementation is really not as clean and straightforward as it might be. I am also quite new to java and not sure if I am going down the wrong path. Anyone have any suggestions?

+2


a source to share


1 answer


You can try JoSQL , it has a SQL-like language over object collections.



+1


a source







All Articles