IdClass (Java EE 5)

Java EE API


javax.persistence Annotation Type IdClass


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

Implements: Annotation
@Target(value=TYPE)
@Retention(value=RUNTIME)

指定映射到实体的多个字段或属性的复合主键类。

主键类中字段或属性的名称必须与实体的主键字段或属性的名称一致,它们的类型也必须相同。

示例:

@IdClass(com.acme.EmployeePK.class)
   @Entity
   public class Employee {
     @Id String empName;
     @Id Date birthDay;
     ...
   }
 
英文文档:

Specifies a composite primary key class that is mapped to multiple fields or properties of the entity.

The names of the fields or properties in the primary key class and the primary key fields or properties of the entity must correspond and their types must be the same.

   Example:

   @IdClass(com.acme.EmployeePK.class)
   @Entity
   public class Employee {
     @Id String empName;
     @Id Date birthDay;
     ...
   }
 

Since:
Java Persistence 1.0

Required Element Summary
 Class
 

Element Detail

abstract public Class<T> value()
主键类
英文文档:

value

public abstract Class value
Primary key class



Submit a bug or feature

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

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

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