views:

353

answers:

2

I have a Java object that I want to store in a local in-memory database. The Object has a One-Many FK relationship, otherwise it has 20 or so Integer/String/Enumerated fields.

I would like to avoid using a framework.

Even though the objects themselves are not very large, there will be a large amount of these objects being inserted/updated at a high frequency (20,000 updates every 5 seconds).

What is the simplest way to tackle this problem? What I would like is Java Object into this ORM layer, Java Object out out of this ORM layer (when queried for). I want to be able to Query for objects as well.

Any Tips?

+2  A: 

You don't need an ORM solution: you need a caching solution. Here is an overview of the more popular Java grid, caching and clustering solutions.

I would probably start by looking at Terracotta.

You said you didn't want a framework. Well I beg to differ: ORMs are complicated. Caching is complicated. What's more, when you do it yourself you're bound to get it wrong (which is no reflection on you, it applies almost universally). There are issues to consider here beyond the interface like fault-tolerance, consistency, persistence, recovery and so on.

cletus
Can caches be Queried against?
Grasper
Depending on which technology you're using and what exactly you mean by querying (I assume you mean getting lists of objects that match certain possibly complex criteria) the answer is a qualified yes.
cletus
+1  A: 

Prevayler would be best for this, with batched writes.

You want to try it before taking a look at complicated caching and distributing solutions.

Stephan Eggermont