I've been walking down the same road.  I'm also working with PostGIS.  I 
started with Hibernate and then shifted to OpenJPA and haven't looked back.

I am using the NativeQuery mechanism.  I had an exchange with Pinaki regarding 
the Critera API which was added to JPA 2.0 some number of weeks back.  This is 
one way to invoke PostGIS functions but it's really just hiding the native 
characteristic of what are necessarily native functions.  I do, however, 
specify the queries in a separate XML file and then refer to them by name.  In 
my mind, this will simplify migration to Oracle should it become necessary in 
future.

As for the various geographic types, I build a custom AbstractValueHandler for 
serializing/converting the PostGIS representations into the form used in my 
code.  If you work with the org.postgis.* types, this may not even be necessary.

In short, it's doable, but it may take a little work.

-=- Jerry


On Jul 16, 2010, at 11:02 AM, Harald Wellmann [via OpenJPA] wrote:

> I'm currently evaluating OpenJPA as a replacement for Hibernate. I'm rather 
> frustrated by the lack of JPA 2.0 compliance in Hibernate, and I'm glad to 
> say I haven't run into any such problems with OpenJPA so far. 
> 
> On the other hand, there are some extensions beyond the scope of JPA which 
> work with Hibernate and which would have to be replaced as well. 
> 
> Our project uses geodata stored in PostGIS. Hibernate Spatial provides type 
> mappings for the geometry JDBC types and custom HQL operators like WITHIN() 
> corresponding to PostGIS stored procedures. 
> 
> Would it be possible to hook into OpenJPA in a similar manner to support 
> spatial extensions without resorting to native SQL? 
> 
> Best regards, 
> 
> Harald 
> 
> 
> View message @ 
> http://openjpa.208410.n2.nabble.com/OpenJPA-and-PostGIS-or-other-spatial-extensions-tp5302323p5302323.html
>  
> To start a new topic under OpenJPA Users, email 
> [email protected] 
> To unsubscribe from OpenJPA Users, click here.
> 


-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-and-PostGIS-or-other-spatial-extensions-tp5302323p5302479.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to