try {
// truncate using this connection to apply or not depending on
// whether a transaction is in progress
truncate(typeName, session);
} finally {
session.dispose();
}
final FeatureWriter<SimpleFeatureType, SimpleFeature> writer;
writer = dataStore.getFeatureWriterAppend(typeName, transaction);
try {