DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Finally, an ORM That Matches Modern Architectural Patterns!
  • Understanding Polyglot Persistence
  • Mastering Java Persistence: Best Practices for Cloud-Native Applications and Modernization
  • Mastering Persistence: Why the Persistence Layer Is Crucial for Modern Java Applications

Trending

  • Security by Design: Building Full-Stack Applications With DevSecOps
  • Tired of Spring Overhead? Try Dropwizard for Your Next Java Microservice
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • IoT and Cybersecurity: Addressing Data Privacy and Security Challenges
  1. DZone
  2. Data Engineering
  3. Databases
  4. How To use pluggable process variable persistence with Case Files in jBPM 7

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

Tutorial on how to persist case files in a different database table along with ProcessInstanceld in jBPM 7 so you can map your particular business information.

By 
Abhijit Humbe user avatar
Abhijit Humbe
·
Sep. 18, 20 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
3.7K Views

Join the DZone community and get the full member experience.

Join For Free

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'
  • Start case instance with the following payload
    • Java
       




      x
      10


       
      1
       {
      2
        "case-data" : {
      3
      "shippment": {
      4
      "com.Shippment":{
      5
      "shippmentId": 1234,
      6
       "shippmentDestination":"IN"
      7
      } } },
      8
       "case-user-assignments" : {  },
      9
        "case-group-assignments" : { }}
      10
      
                    


  • In database schema you can see two tables with name 'Shippment' and 'MappedVariable'. Entries in these tables look like as
    • Java
       




      x


       
      1
      ysql> select * from Shippment;
      2
      +----+------------+---------------------+
      3
      | id |shippmentId |shippmentDestination |
      4
      +----+------------+---------------------+
      5
      |  1 | 1234       |         IN          |
      6
      |  2 | 4321       |         IN          |
      7
      +----+------------+---------------------+
      8
      2 rows in set (0.00 sec)
      9
      
                    
      10
      
                    
      11
      
                    
      12
      mysql> mysql> select * from MappedVariable;
      13
      +-------------+-------------------+--------+------------+--------------+---------+------------+------------+
      14
      | mappedVarId | processInstanceId | taskId | variableId | variableType | OPTLOCK | workItemId | MAP_VAR_ID |
      15
      +-------------+-------------------+--------+------------+--------------+---------+------------+------------+
      16
      |           1 |                14 |     19 |          1 | com.Shippment |       0 |         28 |          1 |
      17
      |           2 |                15 |     20 |          2 | com.Shippment |       0 |         29 |          2 |
      18
      +-------------+-------------------+--------+------------+--------------+---------+------------+------------+
      19
      2 rows in set (0.00 sec)


Persistence (computer science) Database

Opinions expressed by DZone contributors are their own.

Related

  • Finally, an ORM That Matches Modern Architectural Patterns!
  • Understanding Polyglot Persistence
  • Mastering Java Persistence: Best Practices for Cloud-Native Applications and Modernization
  • Mastering Persistence: Why the Persistence Layer Is Crucial for Modern Java Applications

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!