hibernate/hibernate-orm · error · TransientPropertyValueException
Persistent instance of '${parentEntityName}' references an u
Error message
Persistent instance of '${parentEntityName}' references an unsaved transient instance of '${childEntityName}' (persist the transient instance before flushing) What it means
Error "Persistent instance of '${parentEntityName}' references an unsaved transient instance of '${childEntityName}' (persist the transient instance before flushing)" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java:383
// this is not a real type of cascade, but it's a check that
// is at least a bit sensitive to the cascade style, and it's
// convenient to be able to use the graph-walking logic that
// is already implemented in the Cascade class (though perhaps
// we could reuse the logic in Nullability instead)
public static final CascadingAction<Void> CHECK_ON_FLUSH = new BaseCascadingAction<>() {
@Override
public void cascade(
EventSource session,
Object child,
String childEntityName,
String parentEntityName,
String propertyName,
@Nullable List<String> attributePath,
Void nothing,
boolean isCascadeDeleteEnabled)
throws HibernateException {
if ( child != null && isChildTransient( session, child, childEntityName, isCascadeDeleteEnabled ) ) {
throw new TransientPropertyValueException(
"Persistent instance of '" + parentEntityName
+ "' references an unsaved transient instance of '" + childEntityName
+ "' (persist the transient instance before flushing)",
childEntityName,
parentEntityName,
attributePath == null
? propertyName
: join( ".", attributePath ) + '.' + propertyName
);
}
}
@Override
public Iterator<?> getCascadableChildrenIterator(
EventSource session,
CollectionType collectionType,
Object collection) {
if ( collectionType.isInverse( session.getSessionFactory() ) ) {View on GitHub (pinned to fad1729dce)
Solutions
- Persist the transient child before flushing the parent entity
- Configure cascading so the child is persisted automatically
When it happens
Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java:383 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/380aaecca8a62a79.
Report an issue: GitHub.