Search in sources :

Example 1 with UnresolvedEntityInsertActions

use of org.hibernate.action.internal.UnresolvedEntityInsertActions in project hibernate-orm by hibernate.

the class ActionQueue method serialize.

/**
	 * Used by the owning session to explicitly control serialization of the action queue
	 * 
	 * @param oos The stream to which the action queue should get written
	 * @throws IOException Indicates an error writing to the stream
	 */
public void serialize(ObjectOutputStream oos) throws IOException {
    LOG.trace("Serializing action-queue");
    if (unresolvedInsertions == null) {
        unresolvedInsertions = new UnresolvedEntityInsertActions();
    }
    unresolvedInsertions.serialize(oos);
    for (ListProvider p : EXECUTABLE_LISTS_MAP.values()) {
        ExecutableList<?> l = p.get(this);
        if (l == null) {
            oos.writeBoolean(false);
        } else {
            oos.writeBoolean(true);
            l.writeExternal(oos);
        }
    }
}
Also used : UnresolvedEntityInsertActions(org.hibernate.action.internal.UnresolvedEntityInsertActions)

Example 2 with UnresolvedEntityInsertActions

use of org.hibernate.action.internal.UnresolvedEntityInsertActions in project hibernate-orm by hibernate.

the class ActionQueue method addInsertAction.

private void addInsertAction(AbstractEntityInsertAction insert) {
    if (insert.isEarlyInsert()) {
        // For early inserts, must execute inserts beforeQuery finding non-nullable transient entities.
        // TODO: find out why this is necessary
        LOG.tracev("Executing inserts beforeQuery finding non-nullable transient entities for early insert: [{0}]", insert);
        executeInserts();
    }
    NonNullableTransientDependencies nonNullableTransientDependencies = insert.findNonNullableTransientEntities();
    if (nonNullableTransientDependencies == null) {
        LOG.tracev("Adding insert with no non-nullable, transient entities: [{0}]", insert);
        addResolvedEntityInsertAction(insert);
    } else {
        if (LOG.isTraceEnabled()) {
            LOG.tracev("Adding insert with non-nullable, transient entities; insert=[{0}], dependencies=[{1}]", insert, nonNullableTransientDependencies.toLoggableString(insert.getSession()));
        }
        if (unresolvedInsertions == null) {
            unresolvedInsertions = new UnresolvedEntityInsertActions();
        }
        unresolvedInsertions.addUnresolvedEntityInsertAction(insert, nonNullableTransientDependencies);
    }
}
Also used : NonNullableTransientDependencies(org.hibernate.engine.internal.NonNullableTransientDependencies) UnresolvedEntityInsertActions(org.hibernate.action.internal.UnresolvedEntityInsertActions)

Aggregations

UnresolvedEntityInsertActions (org.hibernate.action.internal.UnresolvedEntityInsertActions)2 NonNullableTransientDependencies (org.hibernate.engine.internal.NonNullableTransientDependencies)1