use of org.apache.cayenne.map.DbKeyGenerator in project cayenne by apache.
the class PKCustomSequenceGeneratorPanel method setPKSize.
protected void setPKSize(String text) {
if (mediator.getCurrentDbEntity() == null || mediator.getCurrentDbEntity().getPrimaryKeyGenerator() == null) {
return;
}
int cacheSize = 0;
if (text != null && text.trim().length() > 0) {
try {
cacheSize = Integer.parseInt(text);
} catch (NumberFormatException nfex) {
throw new ValidationException("Invalid number");
}
}
DbKeyGenerator generator = mediator.getCurrentDbEntity().getPrimaryKeyGenerator();
if (!Util.nullSafeEquals(generator.getKeyCacheSize(), new Integer(cacheSize))) {
generator.setKeyCacheSize(new Integer(cacheSize));
mediator.fireDbEntityEvent(new EntityEvent(this, generator.getDbEntity()));
}
}
Aggregations