You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Rick Curtis <cu...@gmail.com> on 2012/11/07 14:37:55 UTC

Re: openjpa-kernel : using PostgreSQL's inet operators in JPQL

> Do I need to patch openjpa and extend JPQL.jjt and
JPQLExpressionBuilder.java? Is there another possibility?
AFIK that would be the only way to add additional JPQL features.... that
being said, I don't think it would be a trivial exercise and I don't think
any of that part of the code was meant to be extensible / contain database
specific operators.

Thanks,
Rick


On Tue, Nov 6, 2012 at 9:53 AM, Rade Martinović <ra...@rcub.bg.ac.rs> wrote:

> Hello all.
>
> For past few days am I investigating the possibility of using postgres'
> inet datatype in JPQL expressions.
>
> Of course, I can use NativeQuery, but I would like to refrain from using
> it if not absolutely necessary.
>
> I've created InetFieldStrategy which extends StringFieldStrategy and I've
> mapped it as default for all IPAddresses in my model. Loading, merging and
> persisting inets work fine. (of course, it would be nice if only there was
> some example how to create strategies, I've had some rough times).
>
> Now I would like to use inet operators to query database. All standard
> JPQL operators (such as <, >, <=, >=, <>, =) work fine. I guess that this
> is due to fact that OpenJPA now treats inet fields internally as Strings.
>
> But I would like also to use <<, >> (contains subnet, subnet contains)
> operators. JPQL parser complains that it does not recognize literals "<<"
> or ">>".
>
> Do I need to patch openjpa and extend JPQL.jjt and
> JPQLExpressionBuilder.java? Is there another possibility?
>
> Thank you for your answer.
> --
> Rade Martinović, M.Sc.E.E
> Software architect
>
> Belgrade University Computer Center
> Kumanovska 7, 126119 Beograd
> Serbia
>
> Tel:            +381-11-3031258
> Fax:            +381-11-3031259
> Email:          rade@rcub.bg.ac.rs
> Internet:       http://www.rcub.bg.ac.rs




-- 
*Rick Curtis*

Re: openjpa-kernel : using PostgreSQL's inet operators in JPQL

Posted by Michael Dick <mi...@gmail.com>.
You're right about not all of Kodo's features being added to OpenJPA.

Feel free to make a feature request, in JIRA. Unfortunately a lot of the
former Kodo developers are busy on other projects, and the rest of the
OpenJPA developers might not be familiar with Kodo's features.

What I'm getting at here is that you might have to do a lot of research to
get the feature into OpenJPA. We don't have the original implementers at
hand, or the original code base to donate.

-mike


On Thu, Nov 15, 2012 at 6:00 AM, RadeMartinovic <ra...@rcub.bg.ac.rs> wrote:

> Michael,
>
> I did some research. I think that Query Filter Extensions were planed in
> Kodo but were not implemented. AFAIK big part of Kodo's codebase was at one
> point donated to OpenJPA. The only extension I've managed to find in the
> latest docs of OpenJPA is MethodQL.
>
> Other Query Language Extensions besides Filter Extensions were Aggregate
> Extensions, JDOQL Non-Distinct and JDOQL Subqueries.
>
> Do you think that I should make a feature request in OpenJPA's JIRA?
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/openjpa-kernel-using-PostgreSQL-s-inet-operators-in-JPQL-tp7581619p7581764.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: openjpa-kernel : using PostgreSQL's inet operators in JPQL

Posted by RadeMartinovic <ra...@rcub.bg.ac.rs>.
Michael,

I did some research. I think that Query Filter Extensions were planed in
Kodo but were not implemented. AFAIK big part of Kodo's codebase was at one
point donated to OpenJPA. The only extension I've managed to find in the
latest docs of OpenJPA is MethodQL.

Other Query Language Extensions besides Filter Extensions were Aggregate
Extensions, JDOQL Non-Distinct and JDOQL Subqueries.

Do you think that I should make a feature request in OpenJPA's JIRA?



--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-kernel-using-PostgreSQL-s-inet-operators-in-JPQL-tp7581619p7581764.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: openjpa-kernel : using PostgreSQL's inet operators in JPQL

Posted by Michael Dick <mi...@gmail.com>.
I think Marc published that prior to one of the older releases (OpenJPA
0.9.5, or 0.9.6). Take a look at the latest doc, and see if you can find
something similar there :
http://openjpa.apache.org/builds/latest/docs/docbook/manual.html

That feature may have been deprecated or renamed (I only took a quick look
though...

-mike




On Wed, Nov 14, 2012 at 7:44 AM, RadeMartinovic <ra...@rcub.bg.ac.rs> wrote:

> Thank you for your answer.
>
> Do you think that Query Filter Extensions would be the way to go in my
> case?
> Are you aware of the development in that field?
>
> I've found this documentation
>
> http://people.apache.org/~mprudhom/openjpa/site/openjpa-project/manual/ref_guide_enterprise_queryext.html
> - but this is far from official... I am prepared to use OpenJPA from trunk
> or some branch that supports Query Filter Extensions.
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/openjpa-kernel-using-PostgreSQL-s-inet-operators-in-JPQL-tp7581619p7581738.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: openjpa-kernel : using PostgreSQL's inet operators in JPQL

Posted by RadeMartinovic <ra...@rcub.bg.ac.rs>.
Thank you for your answer.

Do you think that Query Filter Extensions would be the way to go in my case?
Are you aware of the development in that field?

I've found this documentation
http://people.apache.org/~mprudhom/openjpa/site/openjpa-project/manual/ref_guide_enterprise_queryext.html
- but this is far from official... I am prepared to use OpenJPA from trunk
or some branch that supports Query Filter Extensions.



--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-kernel-using-PostgreSQL-s-inet-operators-in-JPQL-tp7581619p7581738.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.