UniqueConstraint (Java EE 5)

Java EE API


javax.persistence Annotation Type UniqueConstraint


@Target(value={})
@Retention(value=RUNTIME)
public @interface UniqueConstraint

Implements: Annotation
@Target(value={})
@Retention(value=RUNTIME)

此注释用于指定为主表格或从属表格生成的 DDL 中要包含唯一约束。
    示例:
    @Entity
    @Table(
        name="EMPLOYEE", 
        uniqueConstraints=
            @UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
    )
    public class Employee { ... }
 
英文文档:

This annotation is used to specify that a unique constraint is to be included in the generated DDL for a primary or secondary table.

    Example:
    @Entity
    @Table(
        name="EMPLOYEE", 
        uniqueConstraints=
            @UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
    )
    public class Employee { ... }
 

Since:
Java Persistence 1.0

Required Element Summary
 String[]
 

Element Detail

abstract public String[] columnNames()
(必须)组成约束的列名称所组成的数组。
英文文档:

columnNames

public abstract String[] columnNames
(Required) An array of the column names that make up the constraint.



Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!