This commit is contained in:
45
src/javax/persistence/Cacheable.java
Normal file
45
src/javax/persistence/Cacheable.java
Normal file
@@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
package javax.persistence;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Specifies whether an entity should be cached if caching is enabled
|
||||
* when the value of the <code>persistence.xml</code> caching element
|
||||
* is <code>ENABLE_SELECTIVE</code> or <code>DISABLE_SELECTIVE</code>.
|
||||
* The value of the <code>Cacheable</code> annotation is inherited by
|
||||
* subclasses; it can be overridden by specifying
|
||||
* <code>Cacheable</code> on a subclass.
|
||||
*
|
||||
* <p> <code>Cacheable(false)</code> means that the entity and its state must
|
||||
* not be cached by the provider.
|
||||
*
|
||||
* @since Java Persistence 2.0
|
||||
*/
|
||||
@Target( { TYPE })
|
||||
@Retention(RUNTIME)
|
||||
public @interface Cacheable {
|
||||
|
||||
/**
|
||||
* (Optional) Whether or not the entity should be cached.
|
||||
* @return boolean
|
||||
*/
|
||||
boolean value() default true;
|
||||
}
|
||||
143
src/javax/persistence/Column.java
Normal file
143
src/javax/persistence/Column.java
Normal file
@@ -0,0 +1,143 @@
|
||||
/** *****************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
***************************************************************************** */
|
||||
package javax.persistence;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Specifies the mapped column for a persistent property or field.
|
||||
* If no <code>Column</code> annotation is specified, the default values apply.
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* Example 1:
|
||||
*
|
||||
* @Column(name="DESC", nullable=false, length=512)
|
||||
* public String getDescription() { return description; }
|
||||
*
|
||||
* Example 2:
|
||||
*
|
||||
* @Column(name="DESC",
|
||||
* columnDefinition="CLOB NOT NULL",
|
||||
* table="EMP_DETAIL")
|
||||
* @Lob
|
||||
* public String getDescription() { return description; }
|
||||
*
|
||||
* Example 3:
|
||||
*
|
||||
* @Column(name="ORDER_COST", updatable=false, precision=12, scale=2)
|
||||
* public BigDecimal getCost() { return cost; }
|
||||
*
|
||||
* </pre></blockquote>
|
||||
*
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
@Target({METHOD, FIELD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface Column {
|
||||
|
||||
/**
|
||||
* (Optional) The name of the column. Defaults to
|
||||
* the property or field name.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* (Optional) Whether the column is a unique key. This is a
|
||||
* shortcut for the <code>UniqueConstraint</code> annotation at the table
|
||||
* level and is useful for when the unique key constraint
|
||||
* corresponds to only a single column. This constraint applies
|
||||
* in addition to any constraint entailed by primary key mapping and
|
||||
* to constraints specified at the table level.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
boolean unique() default false;
|
||||
|
||||
/**
|
||||
* (Optional) Whether the database column is nullable.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
boolean nullable() default true;
|
||||
|
||||
/**
|
||||
* (Optional) Whether the column is included in SQL INSERT
|
||||
* statements generated by the persistence provider.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
boolean insertable() default true;
|
||||
|
||||
/**
|
||||
* (Optional) Whether the column is included in SQL UPDATE
|
||||
* statements generated by the persistence provider.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
boolean updatable() default true;
|
||||
|
||||
/**
|
||||
* (Optional) The SQL fragment that is used when
|
||||
* generating the DDL for the column.
|
||||
* <p>
|
||||
* Defaults to the generated SQL to create a
|
||||
* column of the inferred type.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String columnDefinition() default "";
|
||||
|
||||
/**
|
||||
* (Optional) The name of the table that contains the column.
|
||||
* If absent the column is assumed to be in the primary table.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String table() default "";
|
||||
|
||||
/**
|
||||
* (Optional) The column length. (Applies only if a
|
||||
* string-valued column is used.)
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int length() default 255;
|
||||
|
||||
/**
|
||||
* (Optional) The precision for a decimal (exact numeric)
|
||||
* column. (Applies only if a decimal column is used.)
|
||||
* Value must be set by developer if used when generating
|
||||
* the DDL for the column.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int precision() default 0;
|
||||
|
||||
/**
|
||||
* (Optional) The scale for a decimal (exact numeric) column.
|
||||
* (Applies only if a decimal column is used.)
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int scale() default 0;
|
||||
}
|
||||
43
src/javax/persistence/Entity.java
Normal file
43
src/javax/persistence/Entity.java
Normal file
@@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
package javax.persistence;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Documented;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Specifies that the class is an entity. This annotation is applied to the
|
||||
* entity class.
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
@Documented
|
||||
@Target(TYPE)
|
||||
@Retention(RUNTIME)
|
||||
public @interface Entity {
|
||||
|
||||
/**
|
||||
* (Optional) The entity name. Defaults to the unqualified
|
||||
* name of the entity class. This name is used to refer to the
|
||||
* entity in queries. The name must not be a reserved literal
|
||||
* in the Java Persistence query language.
|
||||
* @return String
|
||||
*/
|
||||
String name() default "";
|
||||
}
|
||||
79
src/javax/persistence/GeneratedValue.java
Normal file
79
src/javax/persistence/GeneratedValue.java
Normal file
@@ -0,0 +1,79 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
package javax.persistence;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Provides for the specification of generation strategies for the
|
||||
* values of primary keys.
|
||||
*
|
||||
* <p> The <code>GeneratedValue</code> annotation
|
||||
* may be applied to a primary key property or field of an entity or
|
||||
* mapped superclass in conjunction with the {@link Id} annotation.
|
||||
* The use of the <code>GeneratedValue</code> annotation is only
|
||||
* required to be supported for simple primary keys. Use of the
|
||||
* <code>GeneratedValue</code> annotation is not supported for derived
|
||||
* primary keys.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* Example 1:
|
||||
*
|
||||
* @Id
|
||||
* @GeneratedValue(strategy=SEQUENCE, generator="CUST_SEQ")
|
||||
* @Column(name="CUST_ID")
|
||||
* public Long getId() { return id; }
|
||||
*
|
||||
* Example 2:
|
||||
*
|
||||
* @Id
|
||||
* @GeneratedValue(strategy=TABLE, generator="CUST_GEN")
|
||||
* @Column(name="CUST_ID")
|
||||
* Long id;
|
||||
* </pre>
|
||||
*
|
||||
* @see Id
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
@Target({METHOD, FIELD})
|
||||
@Retention(RUNTIME)
|
||||
|
||||
public @interface GeneratedValue {
|
||||
/**
|
||||
* (Optional) The primary key generation strategy
|
||||
* that the persistence provider must use to
|
||||
* generate the annotated entity primary key.
|
||||
* @return GenerationType
|
||||
*/
|
||||
@Deprecated
|
||||
GenerationType strategy() default GenerationType.AUTO;
|
||||
|
||||
/**
|
||||
* (Optional) The name of the primary key generator
|
||||
* to use as specified in the SequenceGenerator
|
||||
* or TableGenerator annotation.
|
||||
* <p> Defaults to the id generator supplied by persistence provider.
|
||||
* @return String
|
||||
*/
|
||||
@Deprecated
|
||||
String generator() default "";
|
||||
}
|
||||
56
src/javax/persistence/GenerationType.java
Normal file
56
src/javax/persistence/GenerationType.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
package javax.persistence;
|
||||
|
||||
/**
|
||||
* Defines the types of primary key generation strategies.
|
||||
*
|
||||
* @see GeneratedValue
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
public enum GenerationType {
|
||||
|
||||
/**
|
||||
* Indicates that the persistence provider must assign
|
||||
* primary keys for the entity using an underlying
|
||||
* database table to ensure uniqueness.
|
||||
*/
|
||||
TABLE,
|
||||
|
||||
/**
|
||||
* Indicates that the persistence provider must assign
|
||||
* primary keys for the entity using a database sequence.
|
||||
*/
|
||||
SEQUENCE,
|
||||
|
||||
/**
|
||||
* Indicates that the persistence provider must assign
|
||||
* primary keys for the entity using a database identity column.
|
||||
*/
|
||||
IDENTITY,
|
||||
|
||||
/**
|
||||
* Indicates that the persistence provider should pick an
|
||||
* appropriate strategy for the particular database. The
|
||||
* <code>AUTO</code> generation strategy may expect a database
|
||||
* resource to exist, or it may attempt to create one. A vendor
|
||||
* may provide documentation on how to create such resources
|
||||
* in the event that it does not support schema generation
|
||||
* or cannot create the schema resource at runtime.
|
||||
*/
|
||||
AUTO
|
||||
}
|
||||
55
src/javax/persistence/Id.java
Normal file
55
src/javax/persistence/Id.java
Normal file
@@ -0,0 +1,55 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
package javax.persistence;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Specifies the primary key of an entity.
|
||||
* The field or property to which the <code>Id</code> annotation is applied
|
||||
* should be one of the following types: any Java primitive type;
|
||||
* any primitive wrapper type;
|
||||
* <code>String</code>;
|
||||
* <code>java.util.Date</code>;
|
||||
* <code>java.sql.Date</code>;
|
||||
* <code>java.math.BigDecimal</code>;
|
||||
* <code>java.math.BigInteger</code>.
|
||||
*
|
||||
* <p>The mapped column for the primary key of the entity is assumed
|
||||
* to be the primary key of the primary table. If no <code>Column</code> annotation
|
||||
* is specified, the primary key column name is assumed to be the name
|
||||
* of the primary key property or field.
|
||||
*
|
||||
* <pre>
|
||||
* Example:
|
||||
*
|
||||
* @Id
|
||||
* public Long getId() { return id; }
|
||||
* </pre>
|
||||
*
|
||||
* @see Column
|
||||
* @see GeneratedValue
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
@Target({METHOD, FIELD})
|
||||
@Retention(RUNTIME)
|
||||
|
||||
public @interface Id {}
|
||||
63
src/javax/persistence/Table.java
Normal file
63
src/javax/persistence/Table.java
Normal file
@@ -0,0 +1,63 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
package javax.persistence;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Specifies the primary table for the annotated entity. Additional
|
||||
* tables may be specified using SecondaryTable or SecondaryTables annotation.
|
||||
*
|
||||
* <p> If no <code>Table</code> annotation is specified for an entity
|
||||
* class, the default values apply.
|
||||
*
|
||||
* <pre>
|
||||
* Example:
|
||||
*
|
||||
* @Entity
|
||||
* @Table(name="CUST", schema="RECORDS")
|
||||
* public class Customer { ... }
|
||||
* </pre>
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
@Target(TYPE)
|
||||
@Retention(RUNTIME)
|
||||
public @interface Table {
|
||||
|
||||
/**
|
||||
* (Optional) The name of the table.
|
||||
* <p> Defaults to the entity name.
|
||||
* @return String
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/** (Optional) The catalog of the table.
|
||||
* <p> Defaults to the default catalog.
|
||||
* @return String
|
||||
*/
|
||||
String catalog() default "";
|
||||
|
||||
/** (Optional) The schema of the table.
|
||||
* <p> Defaults to the default schema for user.
|
||||
* @return String
|
||||
*/
|
||||
String schema() default "";
|
||||
|
||||
}
|
||||
45
src/javax/persistence/Transient.java
Normal file
45
src/javax/persistence/Transient.java
Normal file
@@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
package javax.persistence;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Specifies that the property or field is not persistent. It is used
|
||||
* to annotate a property or field of an entity class, mapped
|
||||
* superclass, or embeddable class.
|
||||
*
|
||||
* <pre>
|
||||
* Example:
|
||||
*
|
||||
* @Entity
|
||||
* public class Employee {
|
||||
* @Id int id;
|
||||
* @Transient User currentUser;
|
||||
* ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
@Target({METHOD, FIELD})
|
||||
@Retention(RUNTIME)
|
||||
|
||||
public @interface Transient {}
|
||||
Reference in New Issue
Block a user