cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti with sql not executed?

vamsinipun
Star Contributor
Star Contributor

Dear Team,

          I am using activiti in my spring web application and would like to execute sql statement when the task complete. but it isn't work. please check and tell me the right way.

Thanks

17 REPLIES 17

Please check above xml file.

Finally i executed with static query with given below expression by you

${execution.getEngineServices().getRuntimeService().createNativeExecutionQuery().sql('UPDATE act_custom_process SET status=#{status} WHERE id=#{id}').parameter('status', 'true').parameter('id', '44').singleResult()}

Now, how can i pass dynamic fields instead of static values like 'true' and 44?

daisuke-yoshimo
Star Collaborator
Star Collaborator

You can use variables to pass dynamic fields as the following expression.

${execution.getEngineServices().getRuntimeService().createNativeExecutionQuery().sql('UPDATE act_custom_process SET status=#{status} WHERE id=#{id}').parameter('status', execution.getVariable('flag')).parameter('id', execution.getVariable('id')).singleResult()}

By the way, what was the cause for not working first?

Thank you for your reply once again. almost i reached my requirement. please help me in this too.

Here we have assignee option with variable like ${reporting_manager}. I was set the value through my java code, instead of that how can i set that through sql without java?

daisuke-yoshimo
Star Collaborator
Star Collaborator

You can set variable by the el expression as the following expression.

Activiti User Guide 

${execution.setVariable('reporting_manager', %Value%)}

Hi,

if i execute the query in java class mean listener. how can i get those data?

daisuke-yoshimo
Star Collaborator
Star Collaborator

It is not possible to select from any table.

If it is an Activiti table, you can do it.

k now how can i get the application table data? is there any other way?