A few days ago I was forced to use the following construction for my class declaration:
@Table(name="UserPattern", uniqueConstraints={
@UniqueConstraint(columnNames={"user_id", "patern_id"})
})
I was very surprised by this syntax.
Usually I thought that if I should to pass array to annotation O I should write the following:
declared_inside_annotation_name={value1,value2...}
but in this case it looks like the following:
uniqueConstraints={
@UniqueConstraint(columnNames={"user_id", "patern_id"})
}
@Table annotation declaration:
@Target(TYPE)
@Retention(RUNTIME)
public @interface Table {
String name() default "";
String catalog() default "";
String schema() default "";
UniqueConstraint[] uniqueConstraints() default { };
Index[] indexes() default {};
}
please clarify this syntax.
declared_inside_annotation_name={value1,value2...}and actualuniqueConstraints={single_value}?@Table.uniqueConstraints, which is an array of@UniqueConstraints and contains a single item, with the value@UniqueConstraint.columnNames, which belongs to another object and is an array of strings and contains two items.