org.babyfish.jimmer.sql.ast.mutation.SimpleEntitySaveCommand 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 SimpleEntitySaveCommand
extends Executable>,
AbstractEntitySaveCommand {
@NewChain
@Override
SimpleEntitySaveCommand setMode(SaveMode mode);
@NewChain
@Override
SimpleEntitySaveCommand setAssociatedModeAll(AssociatedSaveMode mode);
@NewChain
@Override
SimpleEntitySaveCommand setAssociatedMode(ImmutableProp prop, AssociatedSaveMode mode);
@NewChain
@Override
default SimpleEntitySaveCommand setAssociatedMode(TypedProp.Association, ?> prop, AssociatedSaveMode mode) {
return setAssociatedMode(prop.unwrap(), mode);
}
@NewChain
@Override
SimpleEntitySaveCommand setKeyProps(ImmutableProp... props);
@NewChain
@Override
default SimpleEntitySaveCommand 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
SimpleEntitySaveCommand setAutoIdOnlyTargetCheckingAll();
@NewChain
@Override
default SimpleEntitySaveCommand setAutoIdOnlyTargetChecking(TypedProp.Association, ?> prop) {
return setAutoIdOnlyTargetChecking(prop.unwrap());
}
@NewChain
@Override
default SimpleEntitySaveCommand setAutoIdOnlyTargetChecking(TypedProp.Association, ?> prop, boolean checking) {
return setAutoIdOnlyTargetChecking(prop.unwrap(), checking);
}
@NewChain
@Override
default SimpleEntitySaveCommand setAutoIdOnlyTargetChecking(ImmutableProp prop) {
return setAutoIdOnlyTargetChecking(prop, true);
}
@NewChain
@Override
SimpleEntitySaveCommand setAutoIdOnlyTargetChecking(ImmutableProp prop, boolean checking);
@NewChain
@Override
default SimpleEntitySaveCommand setDissociateAction(
TypedProp.Reference, ?> prop,
DissociateAction dissociateAction
) {
return setDissociateAction(prop.unwrap(), dissociateAction);
}
@NewChain
@Override
SimpleEntitySaveCommand setDissociateAction(
ImmutableProp prop,
DissociateAction dissociateAction
);
@NewChain
@Override
default SimpleEntitySaveCommand setTargetTransferMode(
TypedProp.ReferenceList, ?> prop,
TargetTransferMode mode
) {
return setTargetTransferMode(prop.unwrap(), mode);
}
@NewChain
@Override
SimpleEntitySaveCommand setTargetTransferMode(
ImmutableProp prop,
TargetTransferMode mode
);
@NewChain
@Override
SimpleEntitySaveCommand setTargetTransferModeAll(TargetTransferMode mode);
@NewChain
@Override
SimpleEntitySaveCommand setLockMode(LockMode lockMode);
/**
* Example: {@code
* sqlClient
* .getEntities()
* .saveCommand(process)
* .setOptimisticLock(ProcessTable.class, (table, vf) -> {
* return Predicate.and(
* table.version().eq(vf.newNumber(ProcessProps.VERSION)),
* table.status().eq(States.PENDING)
* );
* })
* .execute()
* }
*/
@NewChain
> SimpleEntitySaveCommand setOptimisticLock(
Class tableType,
UserOptimisticLock block
);
@NewChain
@Override
SimpleEntitySaveCommand setDeleteMode(DeleteMode mode);
@NewChain
@Override
SimpleEntitySaveCommand addExceptionTranslator(ExceptionTranslator> translator);
}