How to perform CRUD operations to external database by custom coding?

cancel
Showing results for 
Search instead for 
Did you mean: 
Established Member II

How to perform CRUD operations to external database by custom coding?

Jump to solution

Hi,

I am checking the best recommended way to perform CRUD operations on an external MySQL database from within a process.

I wish to do it by custom code, which is the best recommended approach for Alfresco Activiti 1.5.3v... Please guide.

Regards

1 Solution

Accepted Solutions
Intermediate

Re: How to perform CRUD operations to external database by custom coding?

Jump to solution

If you are using Activiti Enterprise, then I would strongly suggest you look at the new Data Model feature.
https://community.alfresco.com/community/bpm/blog/2016/11/17/activiti-enterprise-developer-series-cu... 

By defining  custom data entity, you can write your own CRUD class by implemening the com.activiti.api.datamodel.AlfrescoCustomDataModelService interface.
Hope this helps,

Greg

View solution in original post

7 Replies
Intermediate

Re: How to perform CRUD operations to external database by custom coding?

Jump to solution

If you are using Activiti Enterprise, then I would strongly suggest you look at the new Data Model feature.
https://community.alfresco.com/community/bpm/blog/2016/11/17/activiti-enterprise-developer-series-cu... 

By defining  custom data entity, you can write your own CRUD class by implemening the com.activiti.api.datamodel.AlfrescoCustomDataModelService interface.
Hope this helps,

Greg

View solution in original post

Senior Member

Re: How to perform CRUD operations to external database by custom coding?

Jump to solution
Established Member II

Re: How to perform CRUD operations to external database by custom coding?

Jump to solution

Thank you Greg and Kristen,

I followed the post and was able to recreate the same process on my Alfresco Activiti Enterprise 1.5.3, The activiti based auto CRUD operations on the process for employee table works... data storage and retrieval... but the custom code in the example does no fetch or store data into the salaries table.

I checked the logs and noticed the below info:

08:31:04,056 [http-nio-8080-exec-3] INFO com.activiti.extension.bean.CustomData
ModelServiceImpl - getMappedValue() EntityDefinition [Name=Salary][TableName=nu
ll][Id=null][Attributes=4] [fieldName=Employee No] [variableValue=100]
08:31:04,146 [http-nio-8080-exec-3] INFO com.activiti.extension.bean.CustomData
ModelServiceImpl - getMappedValue() EntityDefinition [Name=Salary][TableName=nu
ll][Id=null][Attributes=4] [fieldName=Employee No] [variableValue=100]
08:31:05,021 [pool-3-thread-2] INFO com.activiti.service.runtime.ActivitiEventP
rocessingService - Processed 11 events

The tableName and ID is not getting set (is null) onto the entityDefinition variable.... any help???

Intermediate

Re: How to perform CRUD operations to external database by custom coding?

Jump to solution

I havent actually walked through the blog example, but I think I have a working sample that I can re-test.

Let me validate the blog post and get back to you.

Thanks,

Greg

Intermediate

Re: How to perform CRUD operations to external database by custom coding?

Jump to solution

I have finally got around to reviewing the custom data model service and it all appears to work as expected.

Perhaps you have missed something in the mapping.

Greg

Established Member II

Re: How to perform CRUD operations to external database by custom coding?

Jump to solution

Hi Greg,

Thank you for checking on your end... 

When I raised the issue I was not quite sure why the logs showed null values for the TableName under:getMappedValue() EntityDefinition [Name=Salary][TableName=null][Id=null],

 

Later on, I believed the Custom Implementation needs to specify the TableName and write code for performing CRUD operations.

My mistake, I forgot to update this ticket later on.

Appreciate your help as always!!!

Regards

Senior Member

Re: How to perform CRUD operations to external database by custom coding?

Jump to solution

Dear Greg Harley,

I am not using enterprise edition, I am using community edition. Kindly help to achieve data model concepts in community edition.

Thanks

Amruta Wandakar