String code;
Integer cont = 0;
EntitySequence entitySequence = getActiveEntitySequence(entityName);
do {
entitySequence.incrementLastValue();
code = entitySequence.getCode();
cont++;
} while (entityName.getIntegrationEntityDAO()
.existsByCode(code)
&& cont < 100);