Hibernate Search Spatial code generation problem

146 views
Skip to first unread message

Pedro Ferreira

unread,
Nov 26, 2015, 6:47:23 AM11/26/15
to Querydsl
Hello, I am doing a project with hibernate search using spatial coordinates for searching. I am using Querydsl Spatial extension (4.0.6) to facilitate the queries, however it is not generating the spatial types in the classes. I think the problem is with the plugin configuration, as I have little experience with maven. I have the standard plugin for Querydsl:

<plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources/java</outputDirectory>
                            <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
</plugin>

Now I have to add the plugin for the spatial generation as listed on your documentation:

<plugin>
        <groupId>com.querydsl</groupId>
        <artifactId>querydsl-maven-plugin</artifactId>
        <version>${querydsl.version}</version>
        <configuration>

          <spatial>true</spatial>
        </configuration>
</plugin>

I don't exactly what else I have to add. I have tried to add an execution, or even place "<spatial>true</spatial>" inside the upper plugin, but with no results. I am using WildFly 9.0.1, NetBeans 8.1, PostgreSQL 9.4.5 and Hibernate 5.0.0

Thanks for your time!

timowest

unread,
Nov 27, 2015, 1:25:23 PM11/27/15
to Querydsl
Could you provide more context:
Does the APT based code generation work at all?
Does it generate classes, but the spatial types are not mapped properly?
Do you use Querydsl with JPA or SQL?

Pedro Ferreira

unread,
Nov 28, 2015, 3:15:53 AM11/28/15
to Querydsl
It is generating the classes, but not the spatial attributes. I am using JPA. For example I have a class Event (using JPA and Hibernate Search annotations):

@Entity
@Indexed
@Spatial(spatialMode = SpatialMode.RANGE)
public class Event extends SEBISEntity { //SEBISEntity is a class with the id for primary key
....
@Latitude
private Double latitude;

@Longitude
private Double longitude;
.....
(gets and sets for latitude and longitude)

Now using your example in the documentation:

Geometry point = Wkt.fromWkt("Point(2 2)");
query.where(event.geo.distance(point).lt(5.0)); //error: event does not have the property geo

What I am missing? Something from PostGIS?

Thanks for your time!
Op vrijdag 27 november 2015 18:25:23 UTC schreef timowest:

timowest

unread,
Nov 28, 2015, 2:57:42 PM11/28/15
to Querydsl
Querydsl JPA provides only support for Geolatte and JTS types, not Search Spatial.

Pedro Ferreira

unread,
Dec 1, 2015, 5:54:03 PM12/1/15
to Querydsl
OK, sorry for my misconception. I am looking forward to the Geolatte types then. Thank you for your response!

Op zaterdag 28 november 2015 19:57:42 UTC schreef timowest:
Reply all
Reply to author
Forward
0 new messages