Foreign Key Constraint Fails

Hello,

 

I have a user input task, a script task to set data,and a write to data store node that were in a large process model. Everything worked fine and write to the DB fine as well. To make things easier, I decided to put these three nodes in its own subprocess. Copied and pasted everything into the subprocess however, as soon as I ran this new process, I got this error and now the data store write isn't happening. Any idea why?

 An error occurred while trying to write to the entity “USER_INFO” [id=24fe567f-17c1-4a15-9f72-a88f6036ebe7@4344, type=USER_INFO (id=6362)] (data store: App Data). Details: org.hibernate.exception.ConstraintViolationException: could not insert: [USERINFODT6973]: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`Appian`.`USER_INFO`, CONSTRAINT `USER_INFO_fk_1` FOREIGN KEY (`USER_ID`) REFERENCES `CORE_Appian_User` (`USER_ID`)) Data: TypedValue[it=6362,v={<null>,0,,,,,,,,,2018-02-08,,<null>}] 

  Discussion posts and replies are publicly visible

Parents
  • Hi CK,

    foreign key constraint is null that why you got this error.

    1)when you are saving your parent table ,in write to data store node collect that data from output of that node.

    2)you said you have taken a sub process node to save the child table(where parent table id is fk),when you are confirming this sub process ,in input variables pass the parent table which you have collected from write to data store node.

    3)map the parent table id in child table in script task which is in sub process .

Reply
  • Hi CK,

    foreign key constraint is null that why you got this error.

    1)when you are saving your parent table ,in write to data store node collect that data from output of that node.

    2)you said you have taken a sub process node to save the child table(where parent table id is fk),when you are confirming this sub process ,in input variables pass the parent table which you have collected from write to data store node.

    3)map the parent table id in child table in script task which is in sub process .

Children
No Data