Java – hibernate spatial index annotation
•
Java
I use JTS geometry objects to store my geometry objects as Oracle SDO_ Geometry. However, when I want to use SDO_ GEOM. When I use the relax method, they don't work properly. I realize that I need to create a spatial index, but I don't know how to use hibernate You know any notes on this question
@Type(type="org.hibernate.spatial.GeometryType") private Geometry area;
Solution
Then, you only need to create an index on the table where these geometries are stored To do this, use SQL
You also need to add the appropriate metadata (before creating the index) so that the index creation has the appropriate information (coordinate system, boundary, tolerance) For example, suppose your geometry is WGS84 coordinates:
insert into user_sdo_geom_Metadata (table_name,column_name,diminfo,srid) values ( 'US_CITIES','GEOMETRY',sdo_dim_array ( sdo_dim_element('long',-180.0,180.0,0.5),sdo_dim_element('lat',-90.0,90.0,0.5) ),4326 ); commit;
Then create the index:
create index us_cities_sx on us_cities (geometry) indextype is mdsys.spatial_index;
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码