mainstringargs
mainstringargs

Reputation: 14381

Writing Simple and Efficient Database Custom ORM Code in Java

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?

Upvotes: 0

Views: 1705

Answers (2)

Stephan Eggermont
Stephan Eggermont

Reputation: 15907

Prevayler would be best for this, with batched writes.

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

Upvotes: 1

cletus
cletus

Reputation: 625097

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.

Upvotes: 2

Related Questions