net.java.ao.schema
Annotation Type SQLType


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface SQLType

Explicitly specifies the underlying database field type for the corresponding field to the method in question. This should be used for use-cases where the default corresponding type for a particular Java return type is inappropriate for the situation. For example:

public interface Book extends Entity {
     public String getTitle();
     public void setTitle(String title);
     
     @SQLType(Types.CLOB)
     public String getText();
     @SQLType(Types.CLOB)
     public void setText(String text);
 }

This annotation can also be used to specify precision and scale for the underlying type. Thus, this annotation is a single-point, one-shot mechanism for controlling the type used for a specific field.

Author:
Daniel Spiewak

Optional Element Summary
 int precision
          Specifies the precision of the SQL type in the underlying field.
 int scale
          Specifies the scale of the SQL type in the underlying field.
 int value
          Specifies the actual SQL type integer which will be used to represent the corresponding field in the database.
 

value

public abstract int value
Specifies the actual SQL type integer which will be used to represent the corresponding field in the database. The type integer is defined by the Types constants list. If unspecified, type will be whatever the default is for a method of the return type in question.

Default:
-1

precision

public abstract int precision
Specifies the precision of the SQL type in the underlying field. If unspecified, the default precision will be used.

Default:
-1

scale

public abstract int scale
Specifies the scale of the SQL type in the underlying field. If unspecified, the default scale will be used.

Default:
-1