id = new NumberKey( tableMap.getIdGenerator()
.getIdAsBigDecimal(dbCon.getConnection(), keyInfo) );
}
else
{
id = new StringKey( tableMap.getIdGenerator()
.getIdAsString(dbCon.getConnection(), keyInfo) );
}
criteria.add( pk.getFullyQualifiedName(), id );
}
}
// Set up Village for the insert.
TableDataSet tds = null;
try
{
tds = new TableDataSet(dbCon.getConnection(), tableName );
Record rec = tds.addRecord();
insertOrUpdateRecord(rec, tableName, criteria);
}
finally
{
if (tds != null) tds.close();
}
// If the primary key column is auto-incremented, get the id
// now.
if ((keyGen != null) && (keyGen.isPostInsert()))
{
if ( pk.getType() instanceof Number )
{
id = new NumberKey( tableMap.getIdGenerator()
.getIdAsBigDecimal(dbCon.getConnection(), keyInfo) );
}
else
{
id = new StringKey( tableMap.getIdGenerator()
.getIdAsString(dbCon.getConnection(), keyInfo) );
}
}
return id;