SecondaryTables (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.persistence Annotation Type SecondaryTables


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

This annotation is used to specify multiple secondary tables for an entity.

    Example 1: Multiple secondary tables assuming primary key columns are named the same in all tables.

    @Entity
    @Table(name="EMPLOYEE")
    @SecondaryTables({
        @SecondaryTable(name="EMP_DETAIL"),
        @SecondaryTable(name="EMP_HIST")
    })
    public class Employee { ... }
    
    Example 2: Multiple secondary tables with differently named primary key columns. 

    @Entity
    @Table(name="EMPLOYEE")
    @SecondaryTables({
        @SecondaryTable(name="EMP_DETAIL", 
            pkJoinColumns=@PrimaryKeyJoinColumn(name="EMPL_ID")),
        @SecondaryTable(name="EMP_HIST", 
            pkJoinColumns=@PrimaryKeyJoinColumn(name="EMPLOYEE_ID"))
    })
    public class Employee { ... }
 

从以下版本开始:
Java Persistence 1.0

Required Element Summary
 SecondaryTable[] value
          The secondary tables for an entity.
 

元素详细信息

value

public abstract SecondaryTable[] value
The secondary tables for an entity.


Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.