private void setGeometryTypeConstraints ( ) throws SQLException { String finalGeometryType = GeoJsonField . GEOMETRY ; if ( finalGeometryTypes . size ( ) == 1 ) { finalGeometryType = ( String ) finalGeometryTypes . iterator ( ) . next ( ) ; } if ( isH2 ) { finalGeometryType = GeoJsonField . GEOMETRY ; //workaround for H2 connection . createStatement ( ) . execute ( String . format ( "ALTER TABLE %s ALTER COLUMN the_geom %s" , tableLocation . toString ( ) , finalGeometryType ) ) ; } else { connection . createStatement ( ) . execute ( String . format ( "ALTER TABLE %s ALTER COLUMN the_geom SET DATA TYPE geometry(%s,%d)" , tableLocation . toString ( ) , finalGeometryType , parsedSRID ) ) ; } }
Adds the geometry type constraint and the SRID