org.babyfish.jimmer.sql.ast.mutation.BatchEntitySaveCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jimmer-sql Show documentation
Show all versions of jimmer-sql Show documentation
A revolutionary ORM framework for both java and kotlin
package org.babyfish.jimmer.sql.ast.mutation;
import org.babyfish.jimmer.lang.NewChain;
import org.babyfish.jimmer.meta.ImmutableProp;
import org.babyfish.jimmer.meta.TypedProp;
import org.babyfish.jimmer.sql.DissociateAction;
import org.babyfish.jimmer.sql.TargetTransferMode;
import org.babyfish.jimmer.sql.ast.Executable;
import org.babyfish.jimmer.sql.ast.table.Table;
import org.babyfish.jimmer.sql.runtime.ExceptionTranslator;
import java.util.Collection;
public interface BatchEntitySaveCommand
extends Executable>,
AbstractEntitySaveCommand {
@NewChain
@Override
BatchEntitySaveCommand setMode(SaveMode mode);
@NewChain
@Override
BatchEntitySaveCommand setAssociatedModeAll(AssociatedSaveMode mode);
@NewChain
@Override
BatchEntitySaveCommand setAssociatedMode(ImmutableProp prop, AssociatedSaveMode mode);
@NewChain
@Override
default BatchEntitySaveCommand setAssociatedMode(TypedProp.Association, ?> prop, AssociatedSaveMode mode) {
return setAssociatedMode(prop.unwrap(), mode);
}
@NewChain
@Override
BatchEntitySaveCommand setKeyProps(ImmutableProp... props);
@NewChain
@Override
default BatchEntitySaveCommand setKeyProps(TypedProp, ?>... props) {
ImmutableProp[] unwrappedProps = new ImmutableProp[props.length];
for (int i = 0; i < props.length; i++) {
unwrappedProps[i] = props[i].unwrap();
}
return setKeyProps(unwrappedProps);
}
@NewChain
@Override
BatchEntitySaveCommand setAutoIdOnlyTargetCheckingAll();
@NewChain
@Override
default BatchEntitySaveCommand setAutoIdOnlyTargetChecking(TypedProp.Association, ?> prop) {
return setAutoIdOnlyTargetChecking(prop.unwrap());
}
@NewChain
@Override
default BatchEntitySaveCommand setAutoIdOnlyTargetChecking(TypedProp.Association, ?> prop, boolean checking) {
return setAutoIdOnlyTargetChecking(prop.unwrap(), checking);
}
@NewChain
@Override
default BatchEntitySaveCommand setAutoIdOnlyTargetChecking(ImmutableProp prop) {
return setAutoIdOnlyTargetChecking(prop, true);
}
@NewChain
@Override
BatchEntitySaveCommand setAutoIdOnlyTargetChecking(ImmutableProp prop, boolean checking);
@NewChain
@Override
default BatchEntitySaveCommand setDissociateAction(
TypedProp.Reference, ?> prop,
DissociateAction dissociateAction
) {
return setDissociateAction(prop.unwrap(), dissociateAction);
}
@NewChain
@Override
BatchEntitySaveCommand setDissociateAction(
ImmutableProp prop,
DissociateAction dissociateAction
);
@NewChain
@Override
default BatchEntitySaveCommand setTargetTransferMode(
TypedProp.ReferenceList, ?> prop,
TargetTransferMode mode
) {
return setTargetTransferMode(prop.unwrap(), mode);
}
@NewChain
@Override
BatchEntitySaveCommand setTargetTransferMode(
ImmutableProp prop,
TargetTransferMode mode
);
@NewChain
@Override
BatchEntitySaveCommand setTargetTransferModeAll(TargetTransferMode mode);
@NewChain
@Override
BatchEntitySaveCommand setLockMode(LockMode lockMode);
/**
* Example: {@code
* sqlClient
* .getEntities()
* .saveEntitiesCommand(
* Arrays.asList(process1, process2, process3)
* )
* .setOptimisticLock(ProcessTable.class, (table, vf) -> {
* return Predicate.and(
* table.version().eq(vf.newNumber(ProcessProps.VERSION)),
* table.status().eq(States.PENDING)
* );
* })
* .execute()
* }
*/
@NewChain
> BatchEntitySaveCommand setOptimisticLock(
Class tableType,
UserOptimisticLock block
);
@NewChain
@Override
BatchEntitySaveCommand setDeleteMode(DeleteMode mode);
@NewChain
@Override
BatchEntitySaveCommand addExceptionTranslator(ExceptionTranslator> translator);
}