2

I am looking for best solution for caching large amount of simple transactional pojo structure in memory. Transactions happen at oracle database on 3-4 tables by external application. Another application is kind of Business Intelligence type, which based on transactions in database evaluates updated pojos(mapped to table) and applies various business rules.

Hibernate solution relies on transactions on same server; where as in our case transactions happen some where else, and not sure cached objects can be queried.

Question:

  1. Is there oracle jdbc API that would trigger update event on java side?
  2. Which Caching solution would support #1,
  3. Is cached objects can be queried?
4

1 回答 1

8

Oracle 数据库支持 Java 触发器,因此理论上您可以自己实现类似的东西,请参阅本指南。理论上,您的 Java 触发器可以调用您正在使用的任何分布式缓存解决方案的客户端库,以更新或驱逐过时的条目。

Oracle 也有自己的缓存解决方案,称为Coherence。它可能内置了这样的集成,或者至少值得一试。搜索“java 分布式缓存”以获取一些替代方案。

据我所知,Hibernate 不支持对存储在其缓存中的对象的查询。

但是,如果您单独缓存整个对象集合,那么有一些库可以让您对这些集合执行类似 SQL 的查询:

  • LambdaJ - 支持高级查询,但速度不快
  • CQEngine - 支持典型查询,速度极快

顺便说一句,我是 CQEngine 的作者。我喜欢这两个库。但请原谅我对自己的轻微偏见:)

于 2012-11-16T00:53:39.523 回答