JoinColumns (Java EE 5)

Java EE API


javax.persistence Annotation Type JoinColumns


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

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

定义复合外键的映射。此注释组合了同一关系的 JoinColumn 注释。

使用 JoinColumns 注释时,每个此类 JoinColumn 注释都必须指定 namereferencedColumnName 元素。

示例:
    @ManyToOne
    @JoinColumns({
        @JoinColumn(name="ADDR_ID", referencedColumnName="ID"),
        @JoinColumn(name="ADDR_ZIP", referencedColumnName="ZIP")
    })
    public Address getAddress() { return address; }
 
英文文档:

Defines mapping for the composite foreign keys. This annotation groups JoinColumn annotations for the same relationship.

When the JoinColumns annotation is used, both the name and the referencedColumnName elements must be specified in each such JoinColumn annotation.

    Example:
    @ManyToOne
    @JoinColumns({
        @JoinColumn(name="ADDR_ID", referencedColumnName="ID"),
        @JoinColumn(name="ADDR_ZIP", referencedColumnName="ZIP")
    })
    public Address getAddress() { return address; }
 

Since:
Java Persistence 1.0

Required Element Summary
 JoinColumn[]
 

Element Detail

abstract public JoinColumn[] value()
英文文档:

value

public abstract JoinColumn[] value


Submit a bug or feature

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

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

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