# Can I generator Id (task or processInstance) by special rule?

**URL:** <https://forum.flowable.org/t/can-i-generator-id-task-or-processinstance-by-special-rule/2738>\
**Category:** Flowable Engine\
**Created:** [October 16, 2018, 3:47am UTC](https://forum.flowable.org/t/can-i-generator-id-task-or-processinstance-by-special-rule/2738 "2018-10-16T03:47:00Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [October 16, 2018, 7:43am UTC](https://forum.flowable.org/t/can-i-generator-id-task-or-processinstance-by-special-rule/2738/4 "2018-10-16T07:43:28Z")

</div>

Denny,

Gateway is not persisted, it does not have id in the runtime.

Each EngineConfiguration (ProcessEngineConfiguration too) can have its own idGenerator (org.flowable.common.engine.impl.AbstractEngineConfiguration#idGenerator).  
So just set your own idGenerator impl. for the process engine.

It helps for executions/processes, cases, etc., but it does not work for e.g. tasks because they do not have their own engine configuration.  
Have a look on `org.flowable.common.engine.impl.db.DbSqlSession#insert`  
I see two possibilities there:

1. implement your own DbSqlSession - you can handle anything there
2. implement custom TaskDataManager (based on `org.flowable.task.service.impl.persistence.entity.data.impl.MybatisTaskDataManager`) to handle task Ids.

Regards  
Martin

---

_[View the full topic](https://forum.flowable.org/t/can-i-generator-id-task-or-processinstance-by-special-rule/2738)._
