Table (Java EE 5)

Java EE API


javax.persistence Annotation Type Table


@Target(value=TYPE)
@Retention(value=RUNTIME)
public @interface Table

Implements: Annotation
@Target(value=TYPE)
@Retention(value=RUNTIME)

此注释为注释的实体指定主表格。使用 SecondaryTableSecondaryTables 注释可以指定其他表格。

如果没有为实体类指定 Table 注释,则应用默认值。

示例:

    @Entity
    @Table(name="CUST", schema="RECORDS")
public class Customer { ... }
 
英文文档:

This annotation specifies the primary table for the annotated entity. Additional tables may be specified using SecondaryTable or SecondaryTables annotation.

If no Table annotation is specified for an entity class, the default values apply.

    Example:

    @Entity
    @Table(name="CUST", schema="RECORDS")
    public class Customer { ... }
 

Since:
Java Persistence 1.0

Optional Element Summary
 String
 String
 String
 UniqueConstraint[]
 

abstract public String name()
(可选)表格的名称。

默认为实体名称。

英文文档:

name

public abstract String name
(Optional) The name of the table.

Defaults to the entity name.

Default:
""

abstract public String catalog()
(可选)表格种类。

默认为默认种类。

英文文档:

catalog

public abstract String catalog
(Optional) The catalog of the table.

Defaults to the default catalog.

Default:
""

abstract public String schema()
(可选)表格模式。

默认为用户的默认模式。

英文文档:

schema

public abstract String schema
(Optional) The schema of the table.

Defaults to the default schema for user.

Default:
""

abstract public UniqueConstraint[] uniqueConstraints()
(可选)对表格设置的唯一约束。仅当表格生成生效时使用。除了应用 ColumnJoinColumn 注释中指定的约束条件和主键映射引起的约束条件外,还应用这些约束条件。

默认为无额外限制。

英文文档:

uniqueConstraints

public abstract UniqueConstraint[] uniqueConstraints
(Optional) Unique constraints that are to be placed on the table. These are only used if table generation is in effect. These constraints apply in addition to any constraints specified by the Column and JoinColumn annotations and constraints entailed by primary key mappings.

Defaults to no additional constraints.

Default:
{}


Submit a bug or feature

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

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

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