MySQL NULL Foreign Key error

We have a table in MySQL called GX_PROJECT_CONTACT that has a foreign key to GX_STATE_R table. The foreign key column's name is STATE_CODE, which can be null. When we insert a new row with null value for STATE_CODE using Workbench, the query runs successfully. However, when we execute the Write to Date store node with exactly the same field values, the node breaks and we get the following Alert: 

 

There is a problem with task “Write to Data Store Entity” in the process “Michel TEST”. An error occurred while trying to write to the entity “ProjectContact” [id=6824e472-1a1e-41cc-92f3-18d93b7051b4@45164, type=GX_ProjectContact (id=6608)] (data store: GX Main). Details: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update: java.sql.BatchUpdateException: Cannot add or update a child row: a foreign key constraint fails (`GX_APP_DEV`.`GX_PROJECT_CONTACT`, CONSTRAINT `GX_PRJ_CONTACT_STATE_FK` FOREIGN KEY (`STATE_CODE`) REFERENCES `GX_STATE_R` (`STATE_CODE`)): com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`GX_APP_DEV`.`GX_PROJECT_CONTACT`, CONSTRAINT `GX_PRJ_CONTACT_STATE_FK` FOREIGN KEY (`STATE_CODE`) REFERENCES `GX_STATE_R` (`STATE_CODE`)) Data: TypedValue[it=6608,v={331930,0CA0550,,,,,,Test,Test,,,,,,,,<null>,<null>,<null>,<null>,<null>}]

  Discussion posts and replies are publicly visible