Simple Java Persistence

Having a separate data tier for all applications is overkill. Just because your working data set may exceed available memory doesn't mean you want to introduce a SQL layer. If you're writing a utility that deals with a very large amount of data or if your writing a GUI app that needs some storage, but want to keep install and management simple, you don't want to require a complex data layer. You always have the option of rolling your own simple database engine but who wants to do that.



What I want to solve this is a general solution comprised of persistent versions of the collection classes that maintain the same access characteristics as their in memory counter parts. The persistent Map class would have a database that's indexed by the key value to support fast key based access. The persistent List class would support fast offset access and iteration. Classes would be stored in the collection databases as serialized bytes.




Map map = new persistentMap("map.data");
List list = new persistentList("array.data");
Set set = new PersistentSet("set.data");



Because the current collection classes don't throw checked IO exceptions these implementations would need to throw unchecked exceptions when IO errors occurred. I don't think that's a problem however given the orthogonal nature of the underlying persistence.



Another dream project for another day.



Updates



While I haven't found the exact implementation I was thinking about, I've found a lot tools that are aimed at the exact sort of problems I mentioned.



The first tool is called Jisp.


Jisp is an embedded database engine designed for programmers who need indexed access to data. Written in Pure Java and tested for portability, Jisp provides a simple, direct solution when an enterprise-class database system is too big or expensive for the task at hand.



If you want to build a GNU licensed tool Jisp is free, otherwise it will cost you $2500.



Another option I've come across that's similar is db40. It's has no free license but is available for a $100 yearly subscription to individuals or $1000 to corporations.



There's also a product called the Infinity Database Engine. It's cheaper at $369 but requires royalties when deployed on J2ME.



I'm sure if I keep digging I will find even more.



On a related note, I found a good article on B-trees in Java Pro magazine.

Comments

Popular posts from this blog

Shark Crackers

Running roughshod or ripshod

Axis, Axes, Axii?