• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to do 'sql like' queries and joins on my java fields  RSS feed

 
drew sollenberger
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm wrapping up a major refactoring of a system which completely removes an un-needed database (legacy from a previous design) and moves state entirely in memory; which makes the entire system so much prettier! However, the largest resistance to moving away from the database for storing temporary/changing state was that they found it useful for debugging the system; the sql calls to query the all the tables essentially allowed them to view the entire state of the system quickly and easily. With the database gone I want to give them a similar method to view the in-memory state, much as they did with the database.

I can allow a user to send a command which writes my in-memory state, completely, to a human readable file for parsing. However; while the file wouldn't be *too* large (it all fits in memory easily), it would be large enough that without abilities to do joins and selects on the data contained it would be nearly impossible for someone to parse what's happening. I need a way to allow for doing these sort of joins/selects easily; preferable with minimal efforts.

A fancy method to allow me to do this while the data is in-memory would be awsome, but I don't nessesarily need that. If there exists some sort of open-source file that could, say, read in searlized objects and still allow some kind of select or parsing on them that woudl be great. Even an open source program which reads in data that is storeded as CSV (or xml or whatever) and does the same would work as well.

Can anyone suggest an API or program which would make this doable with minimal effort?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Google search for "sql like java toolkit" turns up some interesting hits.

For example the joSQL toolkit which claims:

JoSQL (SQL for Java Objects) provides the ability for a developer to apply a SQL statement to a collection of Java Objects. JoSQL provides the ability to search, order and group ANY Java objects and should be applied when you want to perform SQL-like queries on a collection of Java Objects.


Never underestimate the power of a Google query.

Bill
 
drew sollenberger
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh I tried google quite a bit before hand. I kept getting information about toolkits that worked with sql (especially the 'LIKE' command of sql) instead. Of course I didn't think of adding 'toolkit' at the end; 'open source' hadn't worked lol.

Still thank you, I will look into this some more. In the meantime if anyone else has any suggestions that may be worth using. I really want the 'lowest effort' approch possible here; as I feel that with the other changes most of the 'benefit' they think they are getting from this approch will not be avialable so I don't want to waste too much time on providing this.

I am really okay with exporting stuff to a file and parsing what is in the file to provide the sql 'queries'; I need to be able to export state anyways to do a warm restart so that part exists in either case.

Anyways, off to look at this toolkit now; thank you again for the suggestion. I'll let you know rather or not it lokos like it will work.
 
drew sollenberger
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked into JoSQL. It won't do joins across differnt objects; which is an important part of what I need. Any other suggestions?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this is for offline debugging, export the data in a format importable into a database. Then just import it into whatever database you use and join away.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
drew sollenberger wrote:I looked into JoSQL. It won't do joins across differnt objects; which is an important part of what I need. Any other suggestions?


Create a new class of objects combining the searchable parts of your different objects with references back to the originals?

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!