All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.babyfish.jimmer.sql.Saver Maven / Gradle / Ivy

The newest version!
package org.babyfish.jimmer.sql;

import org.babyfish.jimmer.Input;
import org.babyfish.jimmer.sql.ast.mutation.*;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public interface Saver {

     SimpleEntitySaveCommand saveCommand(E entity);

    default  SimpleEntitySaveCommand saveCommand(Input input) {
        return saveCommand(input.toEntity());
    }

     BatchEntitySaveCommand saveEntitiesCommand(Iterable entities);

    default  BatchEntitySaveCommand saveInputsCommand(Iterable> inputs) {
        List entities = inputs instanceof Collection ?
                new ArrayList<>(((Collection)inputs).size()) :
                new ArrayList<>();
        for (Input input : inputs) {
            entities.add(input.toEntity());
        }
        return saveEntitiesCommand(entities);
    }

    /**
     * Save an entity object
     * @param  The type of saved entity
     * @param entity The saved entity object.
     *               

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param mode The save mode of aggregate-root * @param associatedMode The save mode of associated-objects * @return The saved result for single object */ default SimpleSaveResult save( E entity, SaveMode mode, @NotNull AssociatedSaveMode associatedMode ) { return saveCommand(entity) .setMode(mode) .setAssociatedModeAll(associatedMode) .execute(); } /** * Save an entity object * @param The type of saved entity * @param entity The saved entity object. *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param mode The save mode of aggregate-root *

The associated save mode of associated objects is {@link AssociatedSaveMode#REPLACE}

* @return The saved result for single object */ default SimpleSaveResult save(E entity, SaveMode mode) { return saveCommand(entity) .setMode(mode) .execute(); } /** * Save an entity object * @param The type of saved entity * @param entity The saved entity object. *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param associatedMode The save mode of associated-objects *

The save mode of aggregate-root is {@link SaveMode#UPSERT}

* @return The saved result for single object */ default SimpleSaveResult save(E entity, AssociatedSaveMode associatedMode) { return saveCommand(entity) .setAssociatedModeAll(associatedMode) .execute(); } /** * Save an entity object * @param The type of saved entity * @param entity The saved entity object. *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-root is {@link SaveMode#UPSERT}

*

The associated save mode of associated objects is {@link AssociatedSaveMode#REPLACE}

* @return The saved result for single object */ default SimpleSaveResult save(E entity) { return saveCommand(entity).execute(); } /** * Save an input DTO * @param The type of saved entity * @param input The saved input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param mode The save mode of aggregate-root * @param associatedMode The save mode of associated-objects * @return The saved result for single object */ default SimpleSaveResult save(Input input, SaveMode mode, AssociatedSaveMode associatedMode) { return saveCommand(input.toEntity()) .setMode(mode) .setAssociatedModeAll(associatedMode) .execute(); } /** * Save an input DTO * @param The type of saved entity * @param input The saved input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param mode The save mode of aggregate-root *

The associated save mode of associated objects is {@link AssociatedSaveMode#REPLACE}

* @return The saved result for single object */ default SimpleSaveResult save(Input input, SaveMode mode) { return saveCommand(input.toEntity()) .setMode(mode) .execute(); } /** * Save an input DTO * @param The type of saved entity * @param input The saved input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param associatedMode The save mode of associated-objects *

The save mode of aggregate-root is {@link SaveMode#UPSERT}

* @return The saved result for single object */ default SimpleSaveResult save(Input input, AssociatedSaveMode associatedMode) { return saveCommand(input.toEntity()) .setAssociatedModeAll(associatedMode) .execute(); } /** * Save an input DTO * @param The type of saved entity * @param input The saved input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-root is {@link SaveMode#UPSERT}

*

The associated save mode of associated objects is {@link AssociatedSaveMode#REPLACE}

* @return The saved result for single object */ default SimpleSaveResult save(Input input) { return saveCommand(input.toEntity()).execute(); } /** * Insert an entity object * @param entity The inserted entity object * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-root is {@link SaveMode#INSERT_ONLY}
  • *
  • The associated save mode of associated objects is {@link AssociatedSaveMode#APPEND}
  • *
* @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult insert(@NotNull E entity) { return saveCommand(entity) .setMode(SaveMode.INSERT_ONLY) .setAssociatedModeAll(AssociatedSaveMode.APPEND) .execute(); } /** * Insert an entity object * @param entity The inserted entity object * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-root is {@link SaveMode#INSERT_ONLY}

* @param associatedMode The associated save mode of associated objects. * @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult insert(@NotNull E entity, @NotNull AssociatedSaveMode associatedMode) { return saveCommand(entity) .setMode(SaveMode.INSERT_ONLY) .setAssociatedModeAll(associatedMode) .execute(); } /** * Insert an input DTO * @param input The inserted input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-root is {@link SaveMode#INSERT_ONLY}
  • *
  • The associated save mode of associated objects is {@link AssociatedSaveMode#APPEND}
  • *
* @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult insert(@NotNull Input input) { return saveCommand(input) .setMode(SaveMode.INSERT_ONLY) .setAssociatedModeAll(AssociatedSaveMode.APPEND) .execute(); } /** * Insert an input DTO * @param input The inserted input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-root is {@link SaveMode#INSERT_ONLY}

* @param associatedMode The associated save mode of associated objects. * @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult insert(@NotNull Input input, @NotNull AssociatedSaveMode associatedMode) { return saveCommand(input) .setMode(SaveMode.INSERT_ONLY) .setAssociatedModeAll(associatedMode) .execute(); } /** * Insert an entity object if necessary, * if the entity object exists in database, ignore it. *
    *
  • If the value of id property decorated by {@link Id} is specified, * use id value to check whether the entity object exists in database
  • *
  • otherwise, if the values of key properties decorated by {@link Key} is specified * use key values to check whether the entity object exists in database
  • *
  • If neither value of id property nor values of key properties is specified, * exception will be raised.
  • *
* @param entity The inserted entity object * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-root is {@link SaveMode#INSERT_IF_ABSENT}
  • *
  • The associated save mode of associated objects {@link AssociatedSaveMode#APPEND_IF_ABSENT}
  • *
* @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult insertIfAbsent(@NotNull E entity) { return saveCommand(entity) .setMode(SaveMode.INSERT_IF_ABSENT) .setAssociatedModeAll(AssociatedSaveMode.APPEND_IF_ABSENT) .execute(); } /** * Insert an entity object if necessary, * if the entity object exists in database, ignore it. *
    *
  • If the value of id property decorated by {@link Id} is specified, * use id value to check whether the entity object exists in database
  • *
  • otherwise, if the values of key properties decorated by {@link Key} is specified * use key values to check whether the entity object exists in database
  • *
  • If neither value of id property nor values of key properties is specified, * exception will be raised.
  • *
* @param entity The inserted entity object * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-root is {@link SaveMode#INSERT_IF_ABSENT}

* @param associatedMode The associated save mode of associated objects. * * @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult insertIfAbsent(@NotNull E entity, @NotNull AssociatedSaveMode associatedMode) { return saveCommand(entity) .setMode(SaveMode.INSERT_IF_ABSENT) .setAssociatedModeAll(associatedMode) .execute(); } /** * Insert an input DTO if necessary, that means to convert * the input DTO to entity object and save it. * If the entity object exists in database, ignore it. *
    *
  • If the value of id property decorated by {@link Id} is specified, * use id value to check whether the entity object exists in database
  • *
  • otherwise, if the values of key properties decorated by {@link Key} is specified * use key values to check whether the entity object exists in database
  • *
  • If neither value of id property nor values of key properties is specified, * exception will be raised.
  • *
* @param input The inserted input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-root is {@link SaveMode#INSERT_IF_ABSENT}
  • *
  • The associated save mode of associated objects is {@link AssociatedSaveMode#APPEND_IF_ABSENT}
  • *
* @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult insertIfAbsent(@NotNull Input input) { return saveCommand(input) .setMode(SaveMode.INSERT_IF_ABSENT) .setAssociatedModeAll(AssociatedSaveMode.APPEND_IF_ABSENT) .execute(); } /** * Insert an input DTO if necessary, that means to convert * the input DTO to entity object and save it. * If the entity object exists in database, ignore it. *
    *
  • If the value of id property decorated by {@link Id} is specified, * use id value to check whether the entity object exists in database
  • *
  • otherwise, if the values of key properties decorated by {@link Key} is specified * use key values to check whether the entity object exists in database
  • *
  • If neither value of id property nor values of key properties is specified, * exception will be raised.
  • *
* @param input The inserted input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-root is {@link SaveMode#INSERT_IF_ABSENT}

* @param associatedMode The associated save mode of associated objects. * @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult insertIfAbsent( @NotNull Input input, @NotNull AssociatedSaveMode associatedMode ) { return saveCommand(input) .setMode(SaveMode.INSERT_IF_ABSENT) .setAssociatedModeAll(associatedMode) .execute(); } /** * Update an entity object * @param entity The updated entity object * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-root is {@link SaveMode#UPDATE_ONLY}
  • *
  • The associated save mode of associated objects is {@link AssociatedSaveMode#UPDATE}
  • *
* @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult update(@NotNull E entity) { return saveCommand(entity) .setMode(SaveMode.UPDATE_ONLY) .setAssociatedModeAll(AssociatedSaveMode.UPDATE) .execute(); } /** * Update an entity object * @param entity The updated entity object * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-root is {@link SaveMode#UPDATE_ONLY}

* @param associatedMode The associated save mode of associated objects. * @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult update(@NotNull E entity, @NotNull AssociatedSaveMode associatedMode) { return saveCommand(entity) .setMode(SaveMode.UPDATE_ONLY) .setAssociatedModeAll(associatedMode) .execute(); } /** * Update an input DTO * @param input The updated input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-root is {@link SaveMode#UPDATE_ONLY}
  • *
  • The associated save mode of associated objects is {@link AssociatedSaveMode#UPDATE}
  • *
* @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult update(@NotNull Input input) { return saveCommand(input) .setMode(SaveMode.UPDATE_ONLY) .setAssociatedModeAll(AssociatedSaveMode.UPDATE) .execute(); } /** * Update an input DTO * @param input The updated input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-root is {@link SaveMode#UPDATE_ONLY}

* @param associatedMode The associated save mode of associated objects. * @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult update(@NotNull Input input, @NotNull AssociatedSaveMode associatedMode) { return saveCommand(input) .setMode(SaveMode.UPDATE_ONLY) .setAssociatedModeAll(associatedMode) .execute(); } /** * Merge an entity object * @param entity The merged entity object * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-root is {@link SaveMode#UPSERT}
  • *
  • The associated save mode of associated objects is {@link AssociatedSaveMode#MERGE}
  • *
* @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult merge(@NotNull E entity) { return saveCommand(entity) .setAssociatedModeAll(AssociatedSaveMode.MERGE) .execute(); } /** * Merge an input DTO * @param input The merged input DTO * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-root is {@link SaveMode#UPSERT}
  • *
  • The associated save mode of associated objects is {@link AssociatedSaveMode#MERGE}
  • *
* @return The save result for single object * @param The type of inserted entity */ default SimpleSaveResult merge(@NotNull Input input) { return saveCommand(input) .setAssociatedModeAll(AssociatedSaveMode.MERGE) .execute(); } /** * Save some entities objects * @param entities The saved entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param mode The save mode of aggregate-roots * @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult saveEntities( @NotNull Iterable entities, @NotNull SaveMode mode, @NotNull AssociatedSaveMode associatedMode ) { return saveEntitiesCommand(entities) .setMode(mode) .setAssociatedModeAll(associatedMode) .execute(); } /** * Save some entities objects * @param entities The saved entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#REPLACE}

* @param mode The save mode of aggregate-roots * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult saveEntities(@NotNull Iterable entities, @NotNull SaveMode mode) { return saveEntitiesCommand(entities) .setMode(mode) .execute(); } /** * Save some entities objects * @param entities The saved entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-roots is {@link SaveMode#UPSERT}

* @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult saveEntities(@NotNull Iterable entities, @NotNull AssociatedSaveMode associatedMode) { return saveEntitiesCommand(entities) .setAssociatedModeAll(associatedMode) .execute(); } /** * Save some entities objects * @param entities The saved entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-roots is {@link SaveMode#UPSERT}
  • *
  • The associated save mode of aggregated objects is {@link AssociatedSaveMode#REPLACE}
  • *
* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult saveEntities(@NotNull Iterable entities) { return saveEntitiesCommand(entities) .execute(); } /** * Save some input DTOs * @param inputs The saved input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param mode The save mode of aggregate-roots * @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult saveInputs( @NotNull Iterable> inputs, @NotNull SaveMode mode, @NotNull AssociatedSaveMode associatedMode ) { return saveInputsCommand(inputs) .setMode(mode) .setAssociatedModeAll(associatedMode) .execute(); } /** * Save some input DTOs * @param inputs The saved input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#REPLACE}

* @param mode The save mode of aggregate-roots * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult saveInputs(@NotNull Iterable> inputs, @NotNull SaveMode mode) { return saveInputsCommand(inputs) .setMode(mode) .execute(); } /** * Save some input DTOs * @param inputs The saved input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The save mode of aggregate-roots is {@link SaveMode#UPSERT}

* @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult saveInputs(@NotNull Iterable> inputs, AssociatedSaveMode associatedMode) { return saveInputsCommand(inputs) .setAssociatedModeAll(associatedMode) .execute(); } /** * Save some input DTOs * @param inputs The saved input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *
    *
  • The save mode of aggregate-roots is {@link SaveMode#UPSERT}
  • *
  • The associated save mode of associated objects is {@link AssociatedSaveMode#REPLACE}
  • *
* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult saveInputs(@NotNull Iterable> inputs) { return saveInputsCommand(inputs) .execute(); } /** * Insert some entities objects * @param entities The inserted entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult insertEntities( @NotNull Iterable entities, @NotNull AssociatedSaveMode associatedMode ) { return saveEntitiesCommand(entities) .setMode(SaveMode.INSERT_ONLY) .setAssociatedModeAll(associatedMode) .execute(); } /** * Insert some entities objects * @param entities The inserted entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#APPEND}

* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult insertEntities(@NotNull Iterable entities) { return saveEntitiesCommand(entities) .setMode(SaveMode.INSERT_ONLY) .setAssociatedModeAll(AssociatedSaveMode.APPEND) .execute(); } /** * Insert some input DTOs * @param inputs The inserted input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult insertInputs( @NotNull Iterable> inputs, @NotNull AssociatedSaveMode associatedMode ) { return saveInputsCommand(inputs) .setMode(SaveMode.INSERT_ONLY) .setAssociatedModeAll(associatedMode) .execute(); } /** * Insert some input DTOs * @param inputs The inserted input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#APPEND}

* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult insertInputs(@NotNull Iterable> inputs) { return saveInputsCommand(inputs) .setMode(SaveMode.INSERT_ONLY) .setAssociatedModeAll(AssociatedSaveMode.APPEND_IF_ABSENT) .execute(); } /** * Insert some entity objects if necessary, * if some entity objects exists in database, ignore them. * @param entities The inserted entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult insertEntitiesIfAbsent( @NotNull Iterable entities, @NotNull AssociatedSaveMode associatedMode ) { return saveEntitiesCommand(entities) .setMode(SaveMode.INSERT_IF_ABSENT) .setAssociatedModeAll(associatedMode) .execute(); } /** * Insert some entity objects if necessary, * if some entity objects exists in database, ignore them. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#APPEND_IF_ABSENT}

* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult insertEntitiesIfAbsent(@NotNull Iterable entities) { return saveEntitiesCommand(entities) .setMode(SaveMode.INSERT_IF_ABSENT) .setAssociatedModeAll(AssociatedSaveMode.APPEND_IF_ABSENT) .execute(); } /** * Insert some DTOs if necessary, * if some DTOs exists in database, ignore them. * @param inputs The inserted input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult insertInputsIfAbsent( @NotNull Iterable> inputs, @NotNull AssociatedSaveMode associatedMode ) { return saveInputsCommand(inputs) .setMode(SaveMode.INSERT_IF_ABSENT) .setAssociatedModeAll(associatedMode) .execute(); } /** * Insert some DTOs if necessary, * if some DTOs exists in database, ignore them. * @param inputs The inserted input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#APPEND_IF_ABSENT}

* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult insertInputsIfAbsent(@NotNull Iterable> inputs) { return saveInputsCommand(inputs) .setMode(SaveMode.INSERT_IF_ABSENT) .setAssociatedModeAll(AssociatedSaveMode.APPEND_IF_ABSENT) .execute(); } /** * Update some entities objects * @param entities The updated entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult updateEntities( @NotNull Iterable entities, @NotNull AssociatedSaveMode associatedMode ) { return saveEntitiesCommand(entities) .setMode(SaveMode.UPDATE_ONLY) .setAssociatedModeAll(associatedMode) .execute(); } /** * Update some entities objects * @param entities The updated entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#UPDATE}

* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult updateEntities(@NotNull Iterable entities) { return saveEntitiesCommand(entities) .setMode(SaveMode.UPDATE_ONLY) .setAssociatedModeAll(AssociatedSaveMode.UPDATE) .execute(); } /** * Update some input DTOs * @param inputs The updated input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* @param associatedMode The save mode of associated-objects * @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult updateInputs( @NotNull Iterable> inputs, @NotNull AssociatedSaveMode associatedMode ) { return saveInputsCommand(inputs) .setMode(SaveMode.UPDATE_ONLY) .setAssociatedModeAll(associatedMode) .execute(); } /** * Update some input DTOs * @param inputs The updated input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#UPDATE}

* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult updateInputs(@NotNull Iterable> inputs) { return saveInputsCommand(inputs) .setMode(SaveMode.UPDATE_ONLY) .setAssociatedModeAll(AssociatedSaveMode.UPDATE) .execute(); } /** * Merge some entities objects * @param entities The merged entity objects. * *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#MERGE}

* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult mergeEntities(@NotNull Iterable entities) { return saveEntitiesCommand(entities) .setAssociatedModeAll(AssociatedSaveMode.MERGE) .execute(); } /** * Merge some input DTOs * @param inputs The merged input DTOs. * *

In terms of internal mechanisms, any type of Input DTO is * automatically converted into an entity object of the same type.

* *

Note: The jimmer entity is not POJO, * it can easily express data structures of arbitrary shape, * you can use it to save data structures of arbitrary shape.

* *

Unlike most JVM ORMs, Jimmer does not specified the shape * of the saved data structure by using configuration such as * `insertable`, `updatable` or `cascade`; instead, * it uses the dynamic nature of entity object itself to describe * the shape of saved data structure, without prior design

* *

Unspecified properties will be ignored, * only the specified properties (whether null or not) will be saved. * In addition to objects with only id property, any associated objects * will result in deeper recursive saves.

* *

The associated save mode of associated objects is {@link AssociatedSaveMode#MERGE}

* @param The type of saved entities * @return The saved result for multiple objects */ default BatchSaveResult mergeInputs(@NotNull Iterable> inputs) { return saveInputsCommand(inputs) .setAssociatedModeAll(AssociatedSaveMode.MERGE) .execute(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy