# Annotation Interface SortWeight

@Target(TYPE) @Retention(RUNTIME) @Documented public @interface SortWeight
An annotation that defines the insertion sorting "weight" of an entity that is used when sorting DB operations. This annotation allows to override the topological sorting algorithm used by Cayenne by default in special occasions.

Since:
  3.1, since 4.0 moved to cayenne-server from cayenne-lifecycle

- ## Optional Element Summary

  Optional Elements
  Modifier and Type
  Optional Element
  Description
  `int`
  `value`
  Returns the "weight" of the entity used for the purpose of the DB operations sorting.

- ## Element Details

  - ### value

    int value
    Returns the "weight" of the entity used for the purpose of the DB operations sorting. Entities with lower values will be inserted before entities with higher values. The opposite is true for the delete operations.
    Default:
      `1`