Some times we need to persist case file which includes business information into different database table along with processInstanceId so that you can map business information with particular processInstanceId. We can achieve this with below steps:

  • Define custom data object,define it as Entity and make sure to extend VariableEntity
  • and must implement a Serializable interface, which look like as
  • In kie-workbench, goto Project settings–>Persistence and add custom entity(com.Shippment) and ‘org.drools.persistence.jpa.marshaller.MappedVariable’ under persistable data object, like as
  • Note down the persistence unit name from the top of the screen and update
  • the datasource JNDI and hibernate dialect if needed
  • In kie-workbench, goto Project->Settings->Deployments->Marshalling Strategie and define the following marshaling strategy which is required for case file persistence
  • new org.drools.persistence.jpa.marshaller.JPAPlaceholderResolverStrategy("persistenceUnitName", classLoader);
  • Create a case file variable in case definition of type ‘com.Shippment’

#opensource #jbpm core engine api #jbpm processes

How To use pluggable process variable persistence with Case Files in jBPM 7
3.00 GEEK