Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Geo Spatial Queries with JPA

 
Ryan Kumsher
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the Criteria api, how can I go about using SQL Server 2008 GeoSpatial functions in my queries?

CriteriaBuilder.function() looks promising:

javax.persistence.criteria.CriteriaBuilder

function

<T> Expression<T> function(java.lang.String name,
java.lang.Class<T> type,
Expression<?>... args)

Create an expression for the execution of a database function.

Parameters:
name - function name
type - expected result type
args - function arguments
Returns:
expression




It looks like I can use CriteriaBuilder.function() for static geometry functions, but how would I go about calling a geometry instance function of SQL Server?
Example: shape.STIntersects('POLYGON((1 2,3 4,5 6,1 2))')

Thanks
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!