In one of our use-cases we create a Customer entity within a wizard style process. Each user-task fills a portion of data on the Customer which lies as a variable in the process scope. At the end of the process a super user is informed to check the Customer data and acknowledge or revoke. After acknowledge the Customer gets persisted as an entity in the database (per ServiceTask). But before (while filling the data) a requirement was to not store the Customer as an entity. To achieve this feature we had to rewrite the JPAEntityVariableType to not store entities which have a null id. So that the SerializableType will do the process context persistence.
The following extension to JPAEntityVariableType did it:
The pain here was that the mappings attribute in JPAEntityVariableType is private and could not be used in a sub-class and the necessary method getIdValue in JPAEntityMappings is also not visible. So we had to fully copy paste all the code to new classes, which seems ugly.
So after all description my whish is to add this extension to the activiti code base or at least to make the JPAEntityVariableType and JPAEntityMappings more flexible to extensions. If desired i can provide a patch. Thx.