Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
4 replies
Subscribers
7 subscribers
Views
3074 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Integrations
I am trying to save a CDT to a datastore which has another CDT as a child object
Jin Pheh
Certified Associate Developer
over 12 years ago
I am trying to save a CDT to a datastore which has another CDT as a child object but I am receiving a 'cannot save a null or transient value' error from hibernate.
I would like to save both objects in a single transaction and I have mapped the relationship with 'Cascade=PERSIST' to achieve this but still haven't been able to achieve this. I have also tried setting Cascade to 'ALL' with the same results. Does anyone have any ideas about what else may be wrong?...
OriginalPostID-40694
OriginalPostID-40694
Discussion posts and replies are publicly visible
0
nitishas
over 12 years ago
Try setting nullable=true and verify if it is saving the objects as expected or not.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jin Pheh
Certified Associate Developer
over 12 years ago
Nullable=true was already set however setting the child object with 'Optional=TRUE' did give me a different error: (paraphrasing) Cannot set null childID in parent.childID.
It appears hibernate is trying to save the parent before the child object is flushed so there's no childID to save the relationship with. I cannot remove the 'NOT NULL' restraint on the column for integrity reasons so that's also not an option.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
nitishas
over 12 years ago
Remove the NOT NULL constraints. Hibernate saves the Parent object first and then Child objects and then updates the association.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
erickp
over 6 years ago
in reply to
Jin Pheh
Hi jpeh, did you ever figure out what the problem was and the solution?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel