hi,
the default implementation of SQLDialect returns null for any invocation of
getNextSequenceValue and SQLServerDialect does not override that. Therefore
using GT_PK_METADATA with pk_policy 'sequence' will never work. Could anyone
with enough access apply my implementation of getNextSequenceValue to
SQLServerDialect ?
My implementation
@Override
public Object getNextSequenceValue(String schemaName, String sequenceName,
Connection cx)
throws SQLException {
Statement st = cx.createStatement();
try {
ResultSet rs =
st.executeQuery( "SELECT NEXT VALUE FOR " + sequenceName );
try {
if (!rs.next()) {
throw new SQLException("Could not find next sequence
value");
}
return rs.getInt(1);
} finally {
dataStore.closeSafe(rs);
}
} finally {
dataStore.closeSafe(st);
}
}
This is basically the method copied from the oracle-dialect and with the sql
modified to work with sqlserver. Using getInt instead of getLong is asking for
trouble, imo, but you probably had your reasons.
yours
acefael
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel