All the JPA-QL grammar complexity comes from joins and navigation so I
think if you restrict yourself to no join or limited joins this should
be straightforward for someone that understands ANTLR.
On May 12, 2009, at 11:27, Manik Surtani wrote:
So the plan is that we would implement a new fine-grained model to
replace POJO Cache. Rather than AOP, we would use a JPA-like
session-style interface where we can track changes made to state in
a session to detect field changes [1]. This hugely simplifies the
implementation and makes things more robust, plus provides people
with a familiar JPA API to use.
Now considering the query API, if we are already providing a JPA
interface, this is another reason for the query API to support JPA-
QL rather than just Lucene queries.
The other reason, of course, is easy migration off using databases
for persistence to using a data grid for persistence [2]. Now,
naturally, the designs outlined in [2] can easily be achieved using
Hibernate and a good distributed cache, but what happens when you
don't actually want to persist your data at all, just want it to
live in a grid (because you think your grid is "good enough" to not
be unavailable, and/or your data is transient or can be
recalculated), but you still want to use a JPA interface because
either you are more familiar with it, or you started off storing
this state in JPA and are now rethinking your persistence needs but
don't want to rewrite your app.
Of course, supporting JPA-QL in a distributed cache query API is not
trivial. We know we can do this fairly easily with Lucene queries.
Does anyone know of a mechanism to translate between these easily
enough? If need be, this is something we could build. JPA-QL
grammar is finite and an ANTLR [3] definition to translate these to
Lucene query objects shouldn't be too hard ...
Thoughts?
Manik
[1]
http://www.jboss.org/community/wiki/NewFineGrainedReplicationAPIDesign
[2]
http://web2.sys-con.com/node/951117
[3]
http://www.antlr.org/
--
Manik Surtani
manik(a)jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org