javax.persistence

Annotation Type OrderColumn


  • @Target(value={METHOD,FIELD})
     @Retention(value=RUNTIME)
    public @interface OrderColumn
    Specifies a column that is used to maintain the persistent order of a list. The persistence provider is responsible for maintaining the order upon retrieval and in the database. The persistence provider is responsible for updating the ordering upon flushing to the database to reflect any insertion, deletion, or reordering affecting the list.

    The OrderColumn annotation is specified on a OneToMany or ManyToMany relationship or on an element collection. The OrderColumn annotation is specified on the side of the relationship that references the collection that is to be ordered. The order column is not visible as part of the state of the entity or embeddable class.

    The OrderBy annotation should be used for ordering that is visible as persistent state and maintained by the application. The OrderBy annotation is not used when OrderColumn is specified.

    The order column must be of integral type. The persistence provider maintains a contiguous (non-sparse) ordering of the values of the order column when updating the association or element collection. The order column value for the first element is 0.

    
        Example:
    
        @Entity
        public class CreditCard {
    
           @Id long ccNumber;
    
           @OneToMany  // unidirectional
           @OrderColumn
           List<CardTransaction> transactionHistory;
           ...
        }
    
     
    Since:
    Java Persistence 2.0
    See Also:
    OrderBy
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element and Description
      String columnDefinition
      (Optional) The SQL fragment that is used when generating the DDL for the column.
      boolean insertable
      (Optional) Whether the column is included in SQL INSERT statements generated by the persistence provider.
      String name
      (Optional) The name of the ordering column.
      boolean nullable
      (Optional) Whether the database column is nullable.
      boolean updatable
      (Optional) Whether the column is included in SQL UPDATE statements generated by the persistence provider.

      Retour à la première page de API Java Table des matières Haut

    • Element Detail

      • name

        public abstract String name
        (Optional) The name of the ordering column. Defaults to the concatenation of the name of the referencing property or field; "_"; "ORDER".
        Default:
        ""
      • nullable

        public abstract boolean nullable
        (Optional) Whether the database column is nullable.
        Default:
        true
      • insertable

        public abstract boolean insertable
        (Optional) Whether the column is included in SQL INSERT statements generated by the persistence provider.
        Default:
        true
      • updatable

        public abstract boolean updatable
        (Optional) Whether the column is included in SQL UPDATE statements generated by the persistence provider.
        Default:
        true
      • columnDefinition

        public abstract String columnDefinition
        (Optional) The SQL fragment that is used when generating the DDL for the column. Defaults to generated SQL to create a column of the inferred type.
        Default:
        ""

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

21/08/2025 18:32:14 Cette version de la page est en cache (à la date du 21/08/2025 18:32:14) afin d'accélérer le traitement.
Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.

Document créé le 11/06/2005, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/persistence/OrderColumn.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, OrderColumn (Java(TM) EE 7 Specification APIs)

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.