Skip to main content

Lightweight persistence in the browser and the client

Posted by davidvc on May 25, 2006 at 5:55 PM PDT

A very nice article by Josh
Marinacci
about how to get some simple persistence on the
client side, using the new Java Persistence API.


By the “client side,” in this article Josh means Java
clients, not browser clients. I have been thinking about what it
would mean to get Java Persistence into a browser (assuming that the
app developer wants to work in JavaScript, not Java). I wonder if
Java Persistence really helps, because what you really want is
something native to JavaScript. Well, now what does that mean?
JavaScript is a dynamic language. Object types can and do change
dynamically. So how do you map a JavaScript object into a database
table? Hmm... Something I'm going to go look into.


By the way, Josh uses Hibernate
and HSQL in his example. But Hibernate could be replaced by any lightweight Java
Persistence implemetation, and HSQL could easily be replaced by Java
DB (shameless plug). People regularly ask me why would they want to
use Java DB instead of HSQL, and my answers consistently are: with
Java DB you get full recoverability and database consistency even in
multi-client/multi-threaded applications, you get support from a large established company, and you
get a very robust developer community. These may not be important to
you, but they are important to a lot of folks, and that's why I think
Java DB has value.


Silly database joke: database developers are robust, consistent,
and durable, but they can also be very isolated. Need a hint? See
http://en.wikipedia.org/wiki/ACID