Annotation Type WriteTransformer

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      jakarta.persistence.Column column
      Specify here the column into which the value should be written.
      String method
      The mapped class must have a method with this name which returns a value to be written into the database column.
      Class transformerClass
      User-defined class that must implement the org.eclipse.persistence.mappings.transformers.FieldTransformer interface.
    • Element Detail

      • transformerClass

        Class transformerClass
        User-defined class that must implement the org.eclipse.persistence.mappings.transformers.FieldTransformer interface. The class will be instantiated, its buildFieldValue will be used to create the value to be written into the database column. Note that for ddl generation and returning to be supported the method buildFieldValue in the class should be defined to return the relevant Java type, not just Object as defined in the interface, for instance: public Time buildFieldValue(Object instance, String fieldName, Session session). Either transformerClass or method must be specified, but not both.
        Default:
        void.class
      • method

        String method
        The mapped class must have a method with this name which returns a value to be written into the database column. Note that for ddl generation and returning to be supported the method should be defined to return a particular type, not just Object, for instance: public Time getStartTime(). The method may require an Transient annotation to avoid being mapped as a Basic by default. Either transformerClass or method must be specified, but not both.
        Default:
        ""
      • column

        jakarta.persistence.Column column
        Specify here the column into which the value should be written. The only case when this could be skipped is if a single WriteTransformer annotates an attribute - the attribute's name will be used as a column name.
        Default:
        @jakarta.persistence.Column