id = new NumberKey(
keyGen.getIdAsBigDecimal(con, keyInfo));
}
else
{
id = new StringKey(keyGen.getIdAsString(con, keyInfo));
}
}
catch (Exception e)
{
throwTorqueException(e);
}
criteria.add(pk.getFullyQualifiedName(), id);
}
}
// Use Village to perform the insert.
TableDataSet tds = null;
try
{
tds = new TableDataSet(con, tableName);
Record rec = tds.addRecord();
BasePeer.insertOrUpdateRecord(rec, tableName, criteria);
}
catch (Exception e)
{
throwTorqueException(e);
}
finally
{
if (tds != null)
{
try
{
tds.close();
}
catch (Exception e)
{
throwTorqueException(e);
}
}
}
// If the primary key column is auto-incremented, get the id
// now.
if (pk != null && keyGen != null && keyGen.isPostInsert())
{
try
{
if (pk.getType() instanceof Number)
{
id = new NumberKey(keyGen.getIdAsBigDecimal(con, keyInfo));
}
else
{
id = new StringKey(keyGen.getIdAsString(con, keyInfo));
}
}
catch (Exception e)
{
throwTorqueException(e);