|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||
javax.persistence Annotation Type SecondaryTables
Implements:
Annotation
@Target(value=TYPE)@Retention(value=RUNTIME)
此注释用于为实体类指定多个从属表格。
示例 1:多个从属表格,假定所有表格中的主键列名称相同。
@Entity
@Table(name="EMPLOYEE")
@SecondaryTables({
@SecondaryTable(name="EMP_DETAIL"),
@SecondaryTable(name="EMP_HIST")
})
public class Employee { ... }
示例 2:指定了不同主键列的多个从属表格。
@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 |
|
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 { ... }
- Since:
- Java Persistence 1.0
| Required Element Summary | |
|---|---|
SecondaryTable[] |
value
The secondary tables for an entity. |
| Element Detail |
|---|
abstract public SecondaryTable[]
value()
实体的从属表格。
英文文档:
value
public abstract SecondaryTable[] value
- The secondary tables for an entity.
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!