Annotation Interface LazySQLUpsert


@Documented @Target(METHOD) @Retention(SOURCE) public @interface LazySQLUpsert
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The keys which are used to compare which rows should be updated (those are not updated obviously, but inserted if no match was found
    The table where you want to update/insert
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    If true, the SQL Excetpion will be caught and a runtime Exception will be thrown, so that the method signature does not contain a checked exception.
    boolean
    If true, the db-connection will be opened with a try-with-resources block.
    The name of the method in the LazyDb class.
    If specified, only the fields specified are updated (still everything is inserted).
    The params of the method.
    The names of parameters, which should not be used from the input object (if useObjectAsInput=true),but appended as additionalParameters.
    If specified, instead of generating the input object type, this class is used as the parameter type.
    boolean
    If true (default) we use a single object containing all properties as input (with typesafe builder).
  • Element Details

    • table

      String table
      The table where you want to update/insert
      Returns:
    • keys

      String[] keys
      The keys which are used to compare which rows should be updated (those are not updated obviously, but inserted if no match was found
      Returns:
    • params

      String[] params
      The params of the method. Corresponds to the columns in the table, default to the method parameters
      Returns:
      Default:
      {""}
    • separateParams

      String[] separateParams
      The names of parameters, which should not be used from the input object (if useObjectAsInput=true),but appended as additionalParameters.
      Default:
      {}
    • useObjectAsInput

      boolean useObjectAsInput
      If true (default) we use a single object containing all properties as input (with typesafe builder). If set to false, the parameters are normal method parameters
      Returns:
      Default:
      true
    • useClassAsInput

      Class<?> useClassAsInput
      If specified, instead of generating the input object type, this class is used as the parameter type. It needs to have getters for all parameters. However only the specified parameters are updated, even if the class/interface has more getters
      Default:
      void.class
    • onlyUpdate

      String[] onlyUpdate
      If specified, only the fields specified are updated (still everything is inserted). If empty everything is updated (except for the keys).
      Returns:
      Default:
      {""}
    • methodName

      String methodName
      The name of the method in the LazyDb class. Defaults to the annotated method.
      Returns:
      Default:
      ""
    • manageConnectionWithDatasource

      boolean manageConnectionWithDatasource
      If true, the db-connection will be opened with a try-with-resources block. The Connection will be closed after the method has finished. If dependencyInjection is enabled, the DataSource will be injected in the LazyDB class, otherwise the DataSource will be the first parameter instead of a connection.
      Default:
      false
    • convertSqlExceptionToRuntimeException

      boolean convertSqlExceptionToRuntimeException
      If true, the SQL Excetpion will be caught and a runtime Exception will be thrown, so that the method signature does not contain a checked exception.
      Returns:
      Default:
      false