Search in sources :

Example 1 with ReactiveEntityRegularInsertAction

use of org.hibernate.reactive.engine.impl.ReactiveEntityRegularInsertAction in project hibernate-reactive by hibernate.

the class AbstractReactiveSaveEventListener method addInsertAction.

private CompletionStage<AbstractEntityInsertAction> addInsertAction(Object[] values, Serializable id, Object entity, EntityPersister persister, boolean useIdentityColumn, EventSource source, boolean shouldDelayIdentityInserts) {
    if (useIdentityColumn) {
        ReactiveEntityIdentityInsertAction insert = new ReactiveEntityIdentityInsertAction(values, entity, persister, false, source, shouldDelayIdentityInserts);
        return source.unwrap(ReactiveSession.class).getReactiveActionQueue().addAction(insert).thenApply(v -> insert);
    } else {
        Object version = Versioning.getVersion(values, persister);
        ReactiveEntityRegularInsertAction insert = new ReactiveEntityRegularInsertAction(id, values, entity, version, persister, false, source);
        return source.unwrap(ReactiveSession.class).getReactiveActionQueue().addAction(insert).thenApply(v -> insert);
    }
}
Also used : ReactiveSession(org.hibernate.reactive.session.ReactiveSession) ReactiveEntityRegularInsertAction(org.hibernate.reactive.engine.impl.ReactiveEntityRegularInsertAction) ReactiveEntityIdentityInsertAction(org.hibernate.reactive.engine.impl.ReactiveEntityIdentityInsertAction)

Aggregations

ReactiveEntityIdentityInsertAction (org.hibernate.reactive.engine.impl.ReactiveEntityIdentityInsertAction)1 ReactiveEntityRegularInsertAction (org.hibernate.reactive.engine.impl.ReactiveEntityRegularInsertAction)1 ReactiveSession (org.hibernate.reactive.session.ReactiveSession)1