javax.persistence
Annotation Type SecondaryTables


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

Specifies 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 { ... }
 

Since:
Java Persistence 1.0

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

Element Detail

value

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



Submit a bug or feature

Copyright © 2009, 2010, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 4-June-2010 04:34