In my grails 3.1.5 application I want to execute a query with spatial index using hibernate. For this query I need the key words FORCE INDEX (point)
.
To get a useful object mapping, I use hibernate in combination with gorm (and jts for the geometry for spatial):
compile group: 'com.vividsolutions', name: 'jts', version: '1.8'
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-ehcache:5.0.0.Final"
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.0.0.Final'
compile group: 'org.hibernate', name: 'hibernate-spatial', version: '5.0.0.Final'
The usage of the spatial queries works, so I can launch this query for example:
from PointOfInterest where st_contains(
GeomFromText('Polygon((0 0, 0 100, 100 100,100 0,0 0))'), point) = TRUE
and get the data i want in a bad time.
To get a better time i want to use now the spatial index of point
with this workaround:
http://www.znetdevelopment.com/blogs/2009/10/07/using-use-index-with-hibernatemysql/
My problem now is, that I don't know how I must configure my application.yml
to use hibernate functions such as in the workaround.
My global dataSource configs looks like this:
dataSource:
pooled: true
jmxExport: true
driverClassName: com.mysql.jdbc.Driver
dialect: trip.planner.util.MySQLIndexSpatialDialect // self written
username: root
password:
And my production dataSource settings looks like this:
dataSource:
dbCreate: update
url: jdbc:mysql://localhost:3306/trip_planner
properties:
...
jdbcInterceptors: ConnectionState;trip.planner.util.IndexInterceptor
//IndexInterceptor is self written
So where and how can I configure my IndexInterceptor
with the property-name: hibernate.ejb.interceptor
like in the tutorial (for my application.yml
)?
Aucun commentaire:
Enregistrer un commentaire