if you want to use a custom id generator you can set the property idGenerator in the ProcessEngineConfiguration. See the documentation for more information.
Hi @Zelldon I try to implement the IdGenerator interface as my a custom generator impementation but it return this error:
ENGINE-03002 Cannot add TRANSIENT entity with id ‘ae3a6b50-a7c3-4188-b774-bd9a82368506’
and type ‘class org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity’
into cache. An entity with the same id and type is already in state ‘TRANSIENT’
It seems that your IdGenerator generates no unique id’s since an entity with the same id is already in the cache.
Maybe you have to improve the implementation of the IdGenerator?
Thanks for reply @Zelldon I tried both a simple java UUID and providing during test another kind of UUID for example: AVdhY8XWExrkjWnZiSAT but it still doesn’t work
@Component
public class CustomUuidGenerator implements IdGenerator {
// different ProcessEngines on the same classloader share one generator.
protected static volatile TimeBasedGenerator timeBasedGenerator;
public CustomUuidGenerator() {
ensureGeneratorInitialized();
}
protected void ensureGeneratorInitialized() {
if (timeBasedGenerator == null) {
synchronized (StrongUuidGenerator.class) {
if (timeBasedGenerator == null) {
timeBasedGenerator = Generators.timeBasedGenerator(EthernetAddress.fromInterface());
}
}
}
}
// You can implement your own ID generator here
// The customuuidgenerator class will be loaded before the idgenerator is defined inside camunda
@Override
public String getNextId() {
return timeBasedGenerator.generate().toString().replaceAll("-","");
}