Hibernate Spatial support #692

Closed
timowest opened this Issue Mar 31, 2014 · 13 comments

Comments

Projects
None yet
3 participants
@timowest
Member

timowest commented Mar 31, 2014

Hibernate Spatial support

Challenges

@timowest timowest added the feature label Mar 31, 2014

timowest added a commit that referenced this issue Apr 9, 2014

@jcagarcia

This comment has been minimized.

Show comment
Hide comment
@jcagarcia

jcagarcia Sep 9, 2014

Hi,

I'm trying to use INTERSECTS operation and when generates BooleanExpression i'm getting the following message:

unknown operation with operator com.mysema.query.spatial.SpatialOps#INTERSECTS and args [entity.location, POLYGON((30 10,40 40,20 40,10 20,30 10))]

I'm using HibernateSpatial.. then i'm trying to do the following:

Create my own class based on your HibernateSpatialSupport to create a valid intersects operation to use on HibernateSpatial.

I've created an HibernateSpatialOps with:

private static final String NS = HibernateSpatialOps.class.getName();
public static final Operator<Object> INTERSECTS = new OperatorImpl<Object>( NS, "intersects({0}, {1})");

When i generate BooleanExpression with intersects operation appears the following message:

unknown operation with operator org.project1.querydsl.HibernateSpatialOps#intersects({0}, {1}) and args [entity.location, POLYGON ((-0.948944091796875 39.49052944781087, -0.4988479614257812 39.49052944781087, -0.4988479614257812 39.39030533696812, -0.948944091796875 39.39030533696812, -0.948944091796875 39.49052944781087))]

Can you help me?

Best Regards,

Hi,

I'm trying to use INTERSECTS operation and when generates BooleanExpression i'm getting the following message:

unknown operation with operator com.mysema.query.spatial.SpatialOps#INTERSECTS and args [entity.location, POLYGON((30 10,40 40,20 40,10 20,30 10))]

I'm using HibernateSpatial.. then i'm trying to do the following:

Create my own class based on your HibernateSpatialSupport to create a valid intersects operation to use on HibernateSpatial.

I've created an HibernateSpatialOps with:

private static final String NS = HibernateSpatialOps.class.getName();
public static final Operator<Object> INTERSECTS = new OperatorImpl<Object>( NS, "intersects({0}, {1})");

When i generate BooleanExpression with intersects operation appears the following message:

unknown operation with operator org.project1.querydsl.HibernateSpatialOps#intersects({0}, {1}) and args [entity.location, POLYGON ((-0.948944091796875 39.49052944781087, -0.4988479614257812 39.49052944781087, -0.4988479614257812 39.39030533696812, -0.948944091796875 39.39030533696812, -0.948944091796875 39.49052944781087))]

Can you help me?

Best Regards,

@jcagarcia

This comment has been minimized.

Show comment
Hide comment
@jcagarcia

jcagarcia Sep 11, 2014

Finally I found a solution to solve it.

I've create an HibernateSpatialTemplate that gets ops values from your /test/HibernateSpatialSupport and pass when constructs JPAQuery...

On the other hand i'm using JTS instead of geolate types...I've implemented GeometryExpression, GeometryPath, etc... To recive JTS items... Do you think is a good solution?

Finally I found a solution to solve it.

I've create an HibernateSpatialTemplate that gets ops values from your /test/HibernateSpatialSupport and pass when constructs JPAQuery...

On the other hand i'm using JTS instead of geolate types...I've implemented GeometryExpression, GeometryPath, etc... To recive JTS items... Do you think is a good solution?

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Sep 11, 2014

Member

I am preparing support for it in this branch https://github.com/querydsl/querydsl/tree/i692

It is a similar solution like yours, but still needs the code generation side to be implemented.

Member

timowest commented Sep 11, 2014

I am preparing support for it in this branch https://github.com/querydsl/querydsl/tree/i692

It is a similar solution like yours, but still needs the code generation side to be implemented.

@jcagarcia

This comment has been minimized.

Show comment
Hide comment
@jcagarcia

jcagarcia Sep 12, 2014

Perfect!

Thank you for your work!!

Best Regards,

Perfect!

Thank you for your work!!

Best Regards,

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Sep 25, 2014

Member

@jcagarcia Could you try the new PR I provided? It should give you also the code generation side and automatically register the spatial operations in HQLTemplates.

Member

timowest commented Sep 25, 2014

@jcagarcia Could you try the new PR I provided? It should give you also the code generation side and automatically register the spatial operations in HQLTemplates.

@steventhomson

This comment has been minimized.

Show comment
Hide comment
@steventhomson

steventhomson Oct 10, 2014

@timowest
This will be a great addition the the library! My team is also using hibernate spatial.

I pulled the PR and built the project locally. Then I added the dependency to my project, all is well. I am having trouble generating the code in maven. Could you possibly point me to a sample project or configuration example.

I've tried the configuration from here: http://www.querydsl.com/static/querydsl/3.4.3/reference/html_single/#spatial with no luck. The QClass that is generated has the Geolatte Geometry type as SimplePath instead of GeometryPath. If I try JTS Geometry I get ComparablePath instead of GeometryPath.

Thanks in advance,
Steve

@timowest
This will be a great addition the the library! My team is also using hibernate spatial.

I pulled the PR and built the project locally. Then I added the dependency to my project, all is well. I am having trouble generating the code in maven. Could you possibly point me to a sample project or configuration example.

I've tried the configuration from here: http://www.querydsl.com/static/querydsl/3.4.3/reference/html_single/#spatial with no luck. The QClass that is generated has the Geolatte Geometry type as SimplePath instead of GeometryPath. If I try JTS Geometry I get ComparablePath instead of GeometryPath.

Thanks in advance,
Steve

@steventhomson

This comment has been minimized.

Show comment
Hide comment
@steventhomson

steventhomson Oct 13, 2014

@jcagarcia I was wondering if you could provide a link to your solution?

@jcagarcia I was wondering if you could provide a link to your solution?

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 13, 2014

Member

@steventhomson There is not yet an example project for that. The configuration in the reference docs is for code generation based on JDBC schema inspection. If you want to use JPA annotations instead you should be able to get the desired results using this configuration http://www.querydsl.com/static/querydsl/3.5.0/reference/html/ch02.html#d0e123

Member

timowest commented Oct 13, 2014

@steventhomson There is not yet an example project for that. The configuration in the reference docs is for code generation based on JDBC schema inspection. If you want to use JPA annotations instead you should be able to get the desired results using this configuration http://www.querydsl.com/static/querydsl/3.5.0/reference/html/ch02.html#d0e123

@steventhomson

This comment has been minimized.

Show comment
Hide comment
@steventhomson

steventhomson Oct 13, 2014

@timowest Thanks for the reply! I will try the configuration you pointed out.

@timowest Thanks for the reply! I will try the configuration you pointed out.

@steventhomson

This comment has been minimized.

Show comment
Hide comment
@steventhomson

steventhomson Oct 20, 2014

@timowest The JPA configuration did work for the geolatte geometry type.

@timowest The JPA configuration did work for the geolatte geometry type.

@steventhomson

This comment has been minimized.

Show comment
Hide comment
@steventhomson

steventhomson Oct 24, 2014

@timowest I submitted a pull request that adds JTS Geometries support here: #1011

Let me know if you have any questions or comments.

Thanks again as this lets my team move forward combining spatial queries with regular attribute queries!

@timowest I submitted a pull request that adds JTS Geometries support here: #1011

Let me know if you have any questions or comments.

Thanks again as this lets my team move forward combining spatial queries with regular attribute queries!

@steventhomson

This comment has been minimized.

Show comment
Hide comment
@steventhomson

steventhomson Oct 25, 2014

As suggested pull request #1011 closed and a new one opened with the correct branch here: #1012

As suggested pull request #1011 closed and a new one opened with the correct branch here: #1012

@timowest timowest added this to the 3.6.0 milestone Nov 1, 2014

@Shredder121 Shredder121 closed this in #964 Nov 29, 2014

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Nov 30, 2014

Member

Released in 3.6.0

Member

timowest commented Nov 30, 2014

Released in 3.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment