Write to Data Store Entity failing with - object is an unsaved transient instance - save the transient instance before merging

I am getting an error like - Details: org.hibernate.TransientObjectException: object is an unsaved transient instance - save the transient instance before merging: IAFCharacterDetailsAllegiancesDT6280 - while writing to a data store entity.

I have checked the child CDT, no values are being passed as null. Still no clue why am I getting this error. Can anyone help?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • : I checked the "Updates to a parent value should also update associated child value(s)" in the Foreign Key setup. This helped me get rid of this error.

    However, it says that "This field has a One-to-Many relationship and Master-Detail (Cascade=ALL) behavior" - which should ideally mean that any update on parent should be "cascaded" to the child CDT too. But when I try to truncate the table for parent CDT from MYSQL, it does not let me do it, because of the foreign key constraint. I checked the relationship in the table for child CDT, the foreign key constraint is "restrict". Why is it restrict when the relationship in the CDT clearly says Cascade=ALL?
  • 0
    A Score Level 1
    in reply to saksheer
    When you want to TRUNCATE parent table directly from database, yes it gives this error also to me and to be honest i dont know why. You need probably write your own truncate or delete child data first.
    But when you try to delete parent from smart service "Delete from DataStore entities" it works perfectly and delete also child data (i tried it and it was working), so in application it will be working if you want to delete some records.
  • Thanks for your input. The smart service does allow to delete the data from the entity, but we cannot do it explicitly from DB I guess.