Add 'geography' spatial column type support for SQL Server
Description
It appears that SQL Server 2008 has two types of spatial columns, geometry and geography, but there is no mapping setup for the geography column type in the SQL Server dialect so tables with geography columns types are not being noticed as containing geometry.
Updating the registerSqlTypeNameToClassMappings method in the SQLServerDialect class fixes the problem
@Override public void registerSqlTypeNameToClassMappings( Map<String, Class<?>> mappings) { super.registerSqlTypeNameToClassMappings(mappings);
// also add support nchar and nvarchar mappings.put( "nchar", String.class); mappings.put( "nvarchar", String.class); }
Environment
None
Activity
codehaus
April 10, 2015 at 3:05 PM
CodeHaus Comment From: sforbes - Time: Thu, 24 Jun 2010 04:25:14 -0500 ---------------------
As an added bonus the geography spatial column type doesn't support the .STEnvelope() method, so the SQL generated for bounds calculations need to be redone.
It appears that SQL Server 2008 has two types of spatial columns, geometry and geography, but there is no mapping setup for the geography column type in the SQL Server dialect so tables with geography columns types are not being noticed as containing geometry.
Updating the registerSqlTypeNameToClassMappings method in the SQLServerDialect class fixes the problem
@Override
public void registerSqlTypeNameToClassMappings(
Map<String, Class<?>> mappings)
{
super.registerSqlTypeNameToClassMappings(mappings);
mappings.put( "geometry", Geometry.class );
mappings.put( "geography", Geometry.class );
// also add support nchar and nvarchar
mappings.put( "nchar", String.class);
mappings.put( "nvarchar", String.class);
}