PrimaryKeyJoinColumns (Java EE 5)

Java EE API


javax.persistence Annotation Type PrimaryKeyJoinColumns


@Target(value={TYPE,METHOD,FIELD})
@Retention(value=RUNTIME)
public @interface PrimaryKeyJoinColumns

Implements: Annotation
@Target(value={TYPE, METHOD, FIELD})
@Retention(value=RUNTIME)

此注释组合 PrimaryKeyJoinColumn 注释。它用于映射复合外键。
示例 1:ValuedCustomer 子类

    @Entity
    @Table(name="VCUST")
    @DiscriminatorValue("VCUST")
    @PrimaryKeyJoinColumns({
        @PrimaryKeyJoinColumn(name="CUST_ID", 
            referencedColumnName="ID"),
        @PrimaryKeyJoinColumn(name="CUST_TYPE",
            referencedColumnName="TYPE")
    })
    public class ValuedCustomer extends Customer { ... }
 
英文文档:

This annotation groups PrimaryKeyJoinColumn annotations. It is used to map composite foreign keys.

    Example 1: ValuedCustomer subclass

    @Entity
    @Table(name="VCUST")
    @DiscriminatorValue("VCUST")
    @PrimaryKeyJoinColumns({
        @PrimaryKeyJoinColumn(name="CUST_ID", 
            referencedColumnName="ID"),
        @PrimaryKeyJoinColumn(name="CUST_TYPE",
            referencedColumnName="TYPE")
    })
    public class ValuedCustomer extends Customer { ... }
 

Since:
Java Persistence 1.0

Required Element Summary
 PrimaryKeyJoinColumn[]
 

Element Detail

abstract public PrimaryKeyJoinColumn[] value()
一个或多个 PrimaryKeyJoinColumn 注释。
英文文档:

value

public abstract PrimaryKeyJoinColumn[] value
One or more PrimaryKeyJoinColumn annotations.



Submit a bug or feature

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

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

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