After upgrading Hibernate-spatial to Version 5.0.0.CR2 the following declaration doesn\'t work anymore:
@Column(columnDefinition = \"geometry(Point,4326)\")
@Typ
For Hibernate Spatial 5.2.x, all you need is the below in your entity.
private Point location;
You don't need columnDefinition or Type like the above solutions mentioned.
Some additional details and checks to see if the above works
desc table_name
in mysql, you should see the field type of geometry. This indicates that your hibernate to database mapping is working fine.If the above setup didn't work well, you will typically get the error
Data truncation: Cannot get geometry object from data you send to the GEOMETRY field Blockquote
Hope that helps someone save a 6 hours that I wasted !