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:          r...@rcub.bg.ac.rs
Internet:       http://www.rcub.bg.ac.rs

Reply via email to