use of com.sleepycat.je.tree.DuplicateEntryException in project leopard by tanhaichao.
the class BdbDatabaseImpl method putNoDupData.
@Override
public boolean putNoDupData(String key, String value) throws DatabaseException {
OperationStatus status = database.putNoDupData(transaction, new DatabaseEntry(key.getBytes()), new DatabaseEntry(value.getBytes()));
String result = status.toString();
if (result.endsWith(".KEYEXIST")) {
throw new DuplicateEntryException("key[" + key + "]已存在.");
}
// System.err.println(status);
return true;
}
use of com.sleepycat.je.tree.DuplicateEntryException in project leopard by tanhaichao.
the class IdTransverterBdbImpl method add.
@Override
public boolean add(String tableName, String id, String newId) {
try {
Bdb database = bdb.getDatabase(tableName);
System.err.println("add tableName:" + tableName + " id:" + id);
return database.putNoDupData(id, newId);
} catch (DuplicateEntryException e) {
logger.warn(e.getMessage());
return false;
} catch (DatabaseException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
Aggregations