throws SQLException, IOException {
//create any geometry columns entries after the fact
for ( AttributeDescriptor ad : featureType.getAttributeDescriptors() ) {
if ( ad instanceof GeometryDescriptor ) {
GeometryDescriptor gd = (GeometryDescriptor) ad;
StringBuffer sql = new StringBuffer( "INSERT INTO geometry_columns VALUES (");
//table name
sql.append( "'").append( featureType.getTypeName() ).append( "'," );
//geometry name
sql.append( "'").append( gd.getLocalName() ).append( "',");
//type
String gType = Geometries.getForBinding((Class<? extends Geometry>) gd.getType().getBinding() ).getName();
if ( gType == null ) {
throw new IOException( "Unknown geometry type: " + gd.getType().getBinding() );
}
sql.append( "'").append( gType ).append( "',");
//coord dimension
sql.append( 2 ).append( ",");
//srid
Integer epsgCode = null;
if ( gd.getCoordinateReferenceSystem() != null ) {
CoordinateReferenceSystem crs = gd.getCoordinateReferenceSystem();
try {
epsgCode = CRS.lookupEpsgCode( crs , true );
}
catch (Exception e) {}
}