开发者

How to load JPA entites via dynamic EJB-QL from standalone cache, without hitting the database

I've got a JPA entity that is loaded via dynamic ejb ql queries that can be configured by the user fairly freely. In comes a new requirement: Users should be allowed to create new entities only iff these new entites would be returned by their user specific queries. So, I think I'd need to instanciate a JPA-Entity, create an EJB-Query dynamically and figure out if the entity would be loaded by this query if it开发者_开发问答 existed in the database.

How could I do that? Is there, for example, a standalone JPA cache so that I could push the new JPA entity into the cache and question it with my query, without ever hitting the database?


You could just insert the new entity in database, perform the query, see if the entity is found, and rollback if not found (or delete the entity in the same transaction if you don't want to rollback).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜