Java in memory SQL Table like data structure
Several times I have wanted a data structure that is similar to a SQL Table where you can select on various fields and multiple fields. Similar to an in memory SQL implementation except that I don't want to store that many objects in the data structure.
I also require the object to be serializable through standard Java means.
I have done this before with multiple hash tables or custom hash keys but it ended up being a lot of code and very specific the problem.
I have also used Groovy with its closure ability and gpath to help but I don't always have it available (different projects).
EDIT: I think my problem is more of an object traversal/selection problem Here are some interesting projects:
- http://josql.sourceforge.net/
- http://homepages.mcs.vuw.ac.nz/~djp/JQL/
- http://today.java.net/pub/a/today/2006/08/03/java-object-querying-using-jxpath.html
- http://code.google.com/p/lambdaj/ (I used this in the past and it was.... slow...)
- http://jedi.codehaus.org/ Jedi
However the downside to most of these projects is that they are muc开发者_开发百科h slower than accessing the objects directly (non reflection getter/setter) and definitely slower than an index (hash).
JavaDB and HSQLDB, among others, have fully in-memory databases.
What concerns you about using in-memory SQL storage for these purposes? You'd save a ton of development time; performance overhead is really insignificant. You risk much more by trying to implement this yourself.
精彩评论