Index: 3rdParty_sources/persistence-api/javax/persistence/Access.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Access.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Access.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,41 @@ +/******************************************************************************* + * 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.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Used to specify an access type to be applied to an entity class, + * mapped superclass, or embeddable class, or to a specific attribute + * of such a class. + * + * @since Java Persistence 2.0 + */ +@Target( { TYPE, METHOD, FIELD }) +@Retention(RUNTIME) +public @interface Access { + + /** + * (Required) Specification of field- or property-based access. + */ + AccessType value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/AccessType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/AccessType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/AccessType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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; + +/** + * Used with the {@link Access} annotation to specify an access + * type to be applied to an entity class, mapped superclass, or + * embeddable class, or to a specific attribute of such a class. + * + * @see Access + * + * @since Java Persistence 2.0 + */ +public enum AccessType { + + /** Field-based access is used. */ + FIELD, + + /** Property-based access is used. */ + PROPERTY +} Index: 3rdParty_sources/persistence-api/javax/persistence/AssociationOverride.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/AssociationOverride.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/AssociationOverride.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.0 - Version 2.0 (October 1 - 2013) + * Specification available from http://jcp.org/en/jsr/detail?id=317 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Used to override a mapping for an entity relationship. + * + *

May be applied to an entity that extends a mapped superclass to + * override a relationship mapping defined by the mapped + * superclass. If not specified, the association is mapped the same as + * in the original mapping. When used to override a mapping defined by + * a mapped superclass, AssociationOverride is applied to + * the entity class. + * + *

May be used to override a relationship mapping from an + * embeddable within an entity to another entity when the embeddable + * is on the owning side of the relationship. When used to override a + * relationship mapping defined by an embeddable class (including an + * embeddable class embedded within another embeddable class), + * AssociationOverride is applied to the field or + * property containing the embeddable. + * + *

When AssociationOverride is used to override a + * relationship mapping from an embeddable class, the + * name element specifies the referencing relationship + * field or property within the embeddable class. To override mappings + * at multiple levels of embedding, a dot (".") notation syntax must + * be used in the name element to indicate an attribute + * within an embedded attribute. The value of each identifier used + * with the dot notation is the name of the respective embedded field + * or property. + * + *

When AssociationOverride is applied to override + * the mappings of an embeddable class used as a map value, + * "value." must be used to prefix the name of the + * attribute within the embeddable class that is being overridden in + * order to specify it as part of the map value. + * + *

If the relationship mapping is a foreign key mapping, the + * joinColumns element is used. If the relationship + * mapping uses a join table, the joinTable element must + * be specified to override the mapping of the join table and/or its + * join columns. + * + *

+ *    Example 1: Overriding the mapping of a relationship defined by a mapped superclass
+ *
+ *    @MappedSuperclass
+ *    public class Employee {
+ *        ...
+ *        @ManyToOne
+ *        protected Address address;
+ *        ...
+ *    }
+ *    
+ *    @Entity 
+ *        @AssociationOverride(name="address", 
+ *                             joinColumns=@JoinColumn(name="ADDR_ID"))
+ *        // address field mapping overridden to ADDR_ID foreign key
+ *    public class PartTimeEmployee extends Employee {
+ *        ...
+ *    }
+ * 
+ * + *
+ *    Example 2: Overriding the mapping for phoneNumbers defined in the ContactInfo class
+ *
+ *    @Entity
+ *    public class Employee {
+ *        @Id int id;
+ *        @AssociationOverride(
+ *          name="phoneNumbers",
+ *          joinTable=@JoinTable(
+ *             name="EMPPHONES",
+ *             joinColumns=@JoinColumn(name="EMP"),
+ *             inverseJoinColumns=@JoinColumn(name="PHONE")
+ *          )
+ *        )
+ *        @Embedded ContactInfo contactInfo;
+ *       ...
+ *    }
+ * 
+ *    @Embeddable
+ *    public class ContactInfo {
+ *        @ManyToOne Address address; // Unidirectional
+ *        @ManyToMany(targetEntity=PhoneNumber.class) List phoneNumbers;
+ *    }
+ * 
+ *    @Entity
+ *    public class PhoneNumber {
+ *        @Id int number;
+ *        @ManyToMany(mappedBy="contactInfo.phoneNumbers")
+ *        Collection<Employee> employees;
+ *     }
+ *    
+ * + * @see Embedded + * @see Embeddable + * @see MappedSuperclass + * @see AttributeOverride + * + * @since Java Persistence 1.0 + */ +@Repeatable(AssociationOverrides.class) +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface AssociationOverride { + + /** + * (Required) The name of the relationship property whose mapping is + * being overridden if property-based access is being used, + * or the name of the relationship field if field-based access is used. + */ + String name(); + + /** + * The join column(s) being mapped to the persistent attribute(s). + * The joinColumns elements must be specified if a + * foreign key mapping is used in the overriding of the mapping of + * the relationship. The joinColumns element must + * not be specified if a join table is used in the overriding of + * the mapping of the relationship. + */ + JoinColumn[] joinColumns() default {}; + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint for the columns corresponding to the + * joinColumns element when table generation is in + * effect. If both this element and the foreignKey + * element of any of the joinColumns elements are + * specified, the behavior is undefined. If no foreign key + * annotation element is specified in either location, the + * persistence provider's default foreign key strategy will + * apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); + + /** + * The join table that maps the relationship. + * The joinTable element must be specified if a join table + * is used in the overriding of the mapping of the + * relationship. The joinTable element must not be specified + * if a foreign key mapping is used in the overriding of + * the relationship. + * + * @since Java Persistence 2.0 + */ + JoinTable joinTable() default @JoinTable; +} Index: 3rdParty_sources/persistence-api/javax/persistence/AssociationOverrides.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/AssociationOverrides.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/AssociationOverrides.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,75 @@ +/******************************************************************************* + * 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.ElementType.METHOD; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to override mappings of multiple relationship properties or fields. + * + *
+ *    
+ *    Example:
+ *
+ *    @MappedSuperclass
+ *    public class Employee {
+ *    
+ *        @Id protected Integer id;
+ *        @Version protected Integer version;
+ *        @ManyToOne protected Address address;
+ *        @OneToOne protected Locker locker;
+ *    
+ *        public Integer getId() { ... }
+ *        public void setId(Integer id) { ... }
+ *        public Address getAddress() { ... }
+ *        public void setAddress(Address address) { ... }
+ *        public Locker getLocker() { ... }
+ *        public void setLocker(Locker locker) { ... }
+ *        ...
+ *    }
+ *    
+ *    @Entity
+ *    @AssociationOverrides({
+ *        @AssociationOverride(
+ *                   name="address", 
+ *                   joinColumns=@JoinColumn("ADDR_ID")),
+ *        @AttributeOverride(
+ *                   name="locker", 
+ *                   joinColumns=@JoinColumn("LCKR_ID"))
+ *        })
+ *    public PartTimeEmployee { ... }
+ * 
+ * + *@see AssociationOverride + * + * @since Java Persistence 1.0 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface AssociationOverrides { + + /** + *(Required) The association override mappings that are to be + * applied to the relationship field or property . + */ + AssociationOverride[] value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/AttributeConverter.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/AttributeConverter.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/AttributeConverter.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ +package javax.persistence; + +/** + * A class that implements this interface can be used to convert + * entity attribute state into database column representation + * and back again. + * Note that the X and Y types may be the same Java type. + * + * @param the type of the entity attribute + * @param the type of the database column + */ +public interface AttributeConverter { + + /** + * Converts the value stored in the entity attribute into the + * data representation to be stored in the database. + * + * @param attribute the entity attribute value to be converted + * @return the converted data to be stored in the database + * column + */ + public Y convertToDatabaseColumn (X attribute); + + /** + * Converts the data stored in the database column into the + * value to be stored in the entity attribute. + * Note that it is the responsibility of the converter writer to + * specify the correct dbData type for the corresponding + * column for use by the JDBC driver: i.e., persistence providers are + * not expected to do such type conversion. + * + * @param dbData the data from the database column to be + * converted + * @return the converted value to be stored in the entity + * attribute + */ + public X convertToEntityAttribute (Y dbData); +} Index: 3rdParty_sources/persistence-api/javax/persistence/AttributeNode.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/AttributeNode.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/AttributeNode.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ + +package javax.persistence; + +import java.util.Map; + +/** + * Represents an attribute node of an entity graph. + * + * @param The type of the attribute. + * + * @see EntityGraph + * @see Subgraph + * @see NamedAttributeNode + * + * @since Java Persistence 2.1 + */ +public interface AttributeNode { + + /** + * Return the name of the attribute corresponding to the + * attribute node. + * @return name of the attribute + */ + public String getAttributeName(); + + /** + * Return the Map<Class, Subgraph> of subgraphs associated + * with this attribute node. + * @return Map of subgraphs associated with this attribute node + * or empty Map if none have been defined + */ + public Map getSubgraphs(); + + /** + * Return the Map<Class, Subgraph> of subgraphs associated + * with this attribute node's map key. + * @return Map of subgraphs associated with this attribute + * node's map key or empty Map if none have been defined + */ + public Map getKeySubgraphs(); +} + Index: 3rdParty_sources/persistence-api/javax/persistence/AttributeOverride.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/AttributeOverride.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/AttributeOverride.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,156 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to override the mapping of a Basic (whether + * explicit or default) property or field or Id property or + * field. + * + *

May be applied to an entity that extends a mapped superclass or + * to an embedded field or property to override a basic mapping or id + * mapping defined by the mapped superclass or embeddable class (or + * embeddable class of one of its attributes). + + *

May be applied to an element collection containing instances of + * an embeddable class or to a map collection whose key and/or value + * is an embeddable class. When AttributeOverride is + * applied to a map, "key." or "value." must + * be used to prefix the name of the attribute that is being + * overridden in order to specify it as part of the map key or map + * value. + * + *

To override mappings at multiple levels of embedding, a dot (".") + * notation form must be used in the name element to indicate an + * attribute within an embedded attribute. The value of each identifier + * used with the dot notation is the name of the respective embedded + * field or property. + * + *

If AttributeOverride is not specified, the column + * is mapped the same as in the original mapping. + * + *

+ *    Example 1:
+ *
+ *    @MappedSuperclass
+ *    public class Employee {
+ *        @Id protected Integer id;
+ *        @Version protected Integer version;
+ *        protected String address;
+ *        public Integer getId() { ... }
+ *        public void setId(Integer id) { ... }
+ *        public String getAddress() { ... }
+ *        public void setAddress(String address) { ... }
+ *    }
+ *
+ *    @Entity
+ *    @AttributeOverride(name="address", column=@Column(name="ADDR"))
+ *    public class PartTimeEmployee extends Employee {
+ *        // address field mapping overridden to ADDR
+ *        protected Float wage();
+ *        public Float getHourlyWage() { ... }
+ *        public void setHourlyWage(Float wage) { ... }
+ *    }
+ * 
+ *
+ *    Example 2:
+ *
+ *    @Embeddable public class Address {
+ *        protected String street;
+ *        protected String city;
+ *        protected String state;
+ *        @Embedded protected Zipcode zipcode;
+ *    }
+ *
+ *    @Embeddable public class Zipcode {
+ *        protected String zip;
+ *        protected String plusFour;
+ *    }
+ *
+ *    @Entity public class Customer {
+ *        @Id protected Integer id;
+ *        protected String name;
+ *        @AttributeOverrides({
+ *            @AttributeOverride(name="state",
+ *                               column=@Column(name="ADDR_STATE")),
+ *            @AttributeOverride(name="zipcode.zip",
+ *                               column=@Column(name="ADDR_ZIP"))
+ *        })
+ *        @Embedded protected Address address;
+ *        ...
+ *    }
+ *
+ *
+ *    Example 3:
+ *
+ *    @Entity public class PropertyRecord {
+ *        @EmbeddedId PropertyOwner owner;
+ *        @AttributeOverrides({
+ *            @AttributeOverride(name="key.street", 
+ *                               column=@Column(name="STREET_NAME")),
+ *            @AttributeOverride(name="value.size", 
+ *                               column=@Column(name="SQUARE_FEET")),
+ *            @AttributeOverride(name="value.tax", 
+ *                               column=@Column(name="ASSESSMENT"))
+ *        })
+ *       @ElementCollection
+ *       Map<Address, PropertyInfo> parcels;
+ *    }
+ *
+ *    @Embeddable public class PropertyInfo {
+ *        Integer parcelNumber;
+ *        Integer size;
+ *        BigDecimal tax;
+ *    }
+ *
+ * 
+ * + * @see Embedded + * @see Embeddable + * @see MappedSuperclass + * @see AssociationOverride + * + * @since Java Persistence 1.0 + */ +@Repeatable(AttributeOverrides.class) +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface AttributeOverride { + + /** + * (Required) The name of the property whose mapping is being + * overridden if property-based access is being used, or the + * name of the field if field-based access is used. + */ + String name(); + + /** + * (Required) The column that is being mapped to the persistent + * attribute. The mapping type will remain the same as is + * defined in the embeddable class or mapped superclass. + */ + Column column(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/AttributeOverrides.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/AttributeOverrides.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/AttributeOverrides.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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.TYPE; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to override mappings of multiple properties or fields. + * + *
+ *
+ *    Example:
+ *
+ *    @Embedded
+ *    @AttributeOverrides({
+ *            @AttributeOverride(name="startDate", 
+ *                               column=@Column("EMP_START")),
+ *            @AttributeOverride(name="endDate", 
+ *                               column=@Column("EMP_END"))
+ *    })
+ *    public EmploymentPeriod getEmploymentPeriod() { ... }
+ *
+ * 
+ * + * + * @see AttributeOverride + * + * @since Java Persistence 1.0 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface AttributeOverrides { + + /** (Required) One or more field or property mapping overrides. */ + AttributeOverride[] value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/Basic.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Basic.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Basic.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,81 @@ +/******************************************************************************* + * 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; +import static javax.persistence.FetchType.EAGER; + +/** + * The simplest type of mapping to a database column. The + * Basic annotation can be applied to a persistent + * property or instance variable of any of the following types: Java + * primitive types, wrappers of the primitive types, String, + * java.math.BigInteger, + * java.math.BigDecimal, + * java.util.Date, + * java.util.Calendar, + * java.sql.Date, + * java.sql.Time, + * java.sql.Timestamp, byte[], Byte[], + * char[], Character[], enums, and any other type that + * implements java.io.Serializable. + * + *

The use of the Basic annotation is optional for + * persistent fields and properties of these types. If the + * Basic annotation is not specified for such a field or + * property, the default values of the Basic annotation + * will apply. + * + *

+ *    Example 1:
+ *
+ *    @Basic
+ *    protected String name;
+ *
+ *    Example 2:
+ *
+ *    @Basic(fetch=LAZY)
+ *    protected String getName() { return name; }
+ *
+ * 
+ * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Basic { + + /** + * (Optional) Defines whether the value of the field or property should + * be lazily loaded or must be eagerly fetched. The EAGER + * strategy is a requirement on the persistence provider runtime + * that the value must be eagerly fetched. The LAZY + * strategy is a hint to the persistence provider runtime. + * If not specified, defaults to EAGER. + */ + FetchType fetch() default EAGER; + + /** + * (Optional) Defines whether the value of the field or property may be null. + * This is a hint and is disregarded for primitive types; it may + * be used in schema generation. + * If not specified, defaults to true. + */ + boolean optional() default true; +} Index: 3rdParty_sources/persistence-api/javax/persistence/Cache.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Cache.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Cache.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,68 @@ +/******************************************************************************* + * 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; + +/** + * Interface used to interact with the second-level cache. + * If a cache is not in use, the methods of this interface have + * no effect, except for contains, which returns false. + * + * @since Java Persistence 2.0 + */ +public interface Cache { + + /** + * Whether the cache contains data for the given entity. + * @param cls entity class + * @param primaryKey primary key + * @return boolean indicating whether the entity is in the cache + */ + public boolean contains(Class cls, Object primaryKey); + + /** + * Remove the data for the given entity from the cache. + * @param cls entity class + * @param primaryKey primary key + */ + public void evict(Class cls, Object primaryKey); + + /** + * Remove the data for entities of the specified class (and its + * subclasses) from the cache. + * @param cls entity class + */ + public void evict(Class cls); + + /** + * Clear the cache. + */ + public void evictAll(); + + /** + * Return an object of the specified type to allow access to the + * provider-specific API. If the provider's Cache + * implementation does not support the specified class, the + * PersistenceException is thrown. + * @param cls the class of the object to be returned. This is + * normally either the underlying Cache implementation + * class or an interface that it implements. + * @return an instance of the specified class + * @throws PersistenceException if the provider does not + * support the call + * @since Java Persistence 2.1 + */ + public T unwrap(Class cls); +} Index: 3rdParty_sources/persistence-api/javax/persistence/CacheRetrieveMode.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/CacheRetrieveMode.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/CacheRetrieveMode.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,39 @@ +/******************************************************************************* + * 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; + +/** + * Used as the value of the + * javax.persistence.cache.retrieveMode property to + * specify the behavior when data is retrieved by the + * find methods and by queries. + * + * @since Java Persistence 2.0 + */ +public enum CacheRetrieveMode { + + /** + * Read entity data from the cache: this is + * the default behavior. + */ + USE, + + /** + * Bypass the cache: get data directly from + * the database. + */ + BYPASS +} Index: 3rdParty_sources/persistence-api/javax/persistence/CacheStoreMode.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/CacheStoreMode.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/CacheStoreMode.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,47 @@ +/******************************************************************************* + * 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; + +/** + * Used as the value of the + * javax.persistence.cache.storeMode property to specify + * the behavior when data is read from the database and when data is + * committed into the database. + * + * @since Java Persistence 2.0 + */ +public enum CacheStoreMode { + + /** + * Insert entity data into cache when read from database + * and insert/update entity data when committed into database: + * this is the default behavior. Does not force refresh + * of already cached items when reading from database. + */ + USE, + + /** + * Don't insert into cache. + */ + BYPASS, + + /** + * Insert/update entity data into cache when read + * from database and when committed into database. + * Forces refresh of cache for items read from database. + */ + REFRESH +} Index: 3rdParty_sources/persistence-api/javax/persistence/Cacheable.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Cacheable.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Cacheable.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,44 @@ +/******************************************************************************* + * 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 persistence.xml caching element + * is ENABLE_SELECTIVE or DISABLE_SELECTIVE. + * The value of the Cacheable annotation is inherited by + * subclasses; it can be overridden by specifying + * Cacheable on a subclass. + * + *

Cacheable(false) 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. + */ + boolean value() default true; +} Index: 3rdParty_sources/persistence-api/javax/persistence/CascadeType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/CascadeType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/CascadeType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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 set of cascadable operations that are propagated + * to the associated entity. + * The value cascade=ALL is equivalent to + * cascade={PERSIST, MERGE, REMOVE, REFRESH, DETACH}. + * + * @since Java Persistence 1.0 + */ +public enum CascadeType { + + /** Cascade all operations */ + ALL, + + /** Cascade persist operation */ + PERSIST, + + /** Cascade merge operation */ + MERGE, + + /** Cascade remove operation */ + REMOVE, + + /** Cascade refresh operation */ + REFRESH, + + /** + * Cascade detach operation + * + * @since Java Persistence 2.0 + * + */ + DETACH +} Index: 3rdParty_sources/persistence-api/javax/persistence/CollectionTable.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/CollectionTable.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/CollectionTable.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,171 @@ +/******************************************************************************* + * 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; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Specifies the table that is used for the mapping of + * collections of basic or embeddable types. Applied + * to the collection-valued field or property. + * + *

By default, the columns of the collection table that correspond + * to the embeddable class or basic type are derived from the + * attributes of the embeddable class or from the basic type according + * to the default values of the Column annotation. In the case + * of a basic type, the column name is derived from the name of the + * collection-valued field or property. In the case of an embeddable + * class, the column names are derived from the field or property + * names of the embeddable class. + *

    + *
  • To override the default properties of the column used for a + * basic type, the Column annotation is used on the + * collection-valued attribute in addition to the + * ElementCollection annotation. + * + *
  • To override these defaults for an embeddable class, the + * AttributeOverride and/or + * AttributeOverrides annotations can be used in + * addition to the ElementCollection annotation. If the + * embeddable class contains references to other entities, the default + * values for the columns corresponding to those references may be + * overridden by means of the AssociationOverride and/or + * AssociationOverrides annotations. + *
+ * + *

If the CollectionTable annotation is missing, the + * default values of the CollectionTable annotation + * elements apply. + * + *

+ *    Example:
+ *
+ *    @Embeddable public class Address {
+ *       protected String street;
+ *       protected String city;
+ *       protected String state;
+ *       ... 
+ *     }
+ *
+ *    @Entity public class Person {
+ *       @Id protected String ssn;
+ *       protected String name;
+ *       protected Address home;
+ *       ...
+ *       @ElementCollection  // use default table (PERSON_NICKNAMES)
+ *       @Column(name="name", length=50)
+ *       protected Set<String> nickNames = new HashSet();
+ *       ...
+ *    }
+ *
+ *    @Entity public class WealthyPerson extends Person {
+ *       @ElementCollection
+ *       @CollectionTable(name="HOMES") // use default join column name
+ *       @AttributeOverrides({
+ *          @AttributeOverride(name="street", 
+ *                             column=@Column(name="HOME_STREET")),
+ *          @AttributeOverride(name="city", 
+ *                             column=@Column(name="HOME_CITY")),
+ *          @AttributeOverride(name="state", 
+ *                             column=@Column(name="HOME_STATE"))
+ *        })
+ *       protected Set<Address> vacationHomes = new HashSet();
+ *       ...
+ *    }
+ * 
+ * + * @see ElementCollection + * @see AttributeOverride + * @see AssociationOverride + * @see Column + * + * @since Java Persistence 2.0 + */ + +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface CollectionTable { + + /** + * (Optional) The name of the collection table. If not specified, + * it defaults to the concatenation of the name of the containing + * entity and the name of the collection attribute, separated by + * an underscore. + */ + String name() default ""; + + /** + * (Optional) The catalog of the table. If not specified, the + * default catalog is used. + */ + String catalog() default ""; + + /** + * (Optional) The schema of the table. If not specified, the + * default schema for the user is used. + */ + String schema() default ""; + + /** + * (Optional) The foreign key columns of the collection table + * which reference the primary table of the entity. The default + * only applies if a single join column is used. The default is + * the same as for JoinColumn (i.e., the + * concatenation of the following: the name of the entity; "_"; + * the name of the referenced primary key column.) However, if + * there is more than one join column, a JoinColumn + * annotation must be specified for each join column using the + * JoinColumns annotation. In this case, both the + * name and the referencedColumnName + * elements must be specified in each such + * JoinColumn annotation. + */ + JoinColumn[] joinColumns() default {}; + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint for the columns corresponding to the + * joinColumns element when table generation is in + * effect. If both this element and the foreignKey + * element of any of the joinColumns elements are + * specified, the behavior is undefined. If no foreign key + * annotation element is specified in either location, the + * persistence provider's default foreign key strategy will + * apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); + + /** + * (Optional) Unique constraints that are to be placed on the + * table. These are only used if table generation is in effect. + */ + UniqueConstraint[] uniqueConstraints() default {}; + + /** + * (Optional) Indexes for the table. These are only used if + * table generation is in effect. + * + * @since Java Persistence 2.1 + */ + Index[] indexes() default {}; +} Index: 3rdParty_sources/persistence-api/javax/persistence/Column.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Column.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Column.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,122 @@ +/******************************************************************************* + * 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 Column annotation is specified, the default values apply. + * + *
+ *    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; }
+ *
+ * 
+ * + * + * @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. + */ + String name() default ""; + + /** + * (Optional) Whether the column is a unique key. This is a + * shortcut for the UniqueConstraint 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. + */ + boolean unique() default false; + + /** + * (Optional) Whether the database column is nullable. + */ + boolean nullable() default true; + + /** + * (Optional) Whether the column is included in SQL INSERT + * statements generated by the persistence provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in SQL UPDATE + * statements generated by the persistence provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when + * generating the DDL for the column. + *

Defaults to the generated SQL to create a + * column of the inferred type. + */ + 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. + */ + String table() default ""; + + /** + * (Optional) The column length. (Applies only if a + * string-valued column is used.) + */ + 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. + */ + int precision() default 0; + + /** + * (Optional) The scale for a decimal (exact numeric) column. + * (Applies only if a decimal column is used.) + */ + int scale() default 0; +} Index: 3rdParty_sources/persistence-api/javax/persistence/ColumnResult.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ColumnResult.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ColumnResult.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2014 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.RetentionPolicy.RUNTIME; + +/** + * Used in conjunction with the {@link SqlResultSetMapping} annotation or + * {@link ConstructorResult} annotation to map a column of the SELECT + * list of a SQL query. + * + *

The name element references the name of a column in the SELECT list + * — i.e., column alias, if applicable. Scalar result types can be + * included in the query result by specifying this annotation in + * the metadata. + * + *

+ *
+ * Example:
+ *   Query q = em.createNativeQuery(
+ *       "SELECT o.id AS order_id, " +
+ *           "o.quantity AS order_quantity, " +
+ *           "o.item AS order_item, " + 
+ *           "i.name AS item_name, " +
+ *         "FROM Order o, Item i " +
+ *         "WHERE (order_quantity > 25) AND (order_item = i.id)",
+ *       "OrderResults");
+ *
+ *   @SqlResultSetMapping(name="OrderResults",
+ *       entities={
+ *           @EntityResult(entityClass=com.acme.Order.class, fields={
+ *               @FieldResult(name="id", column="order_id"),
+ *               @FieldResult(name="quantity", column="order_quantity"),
+ *               @FieldResult(name="item", column="order_item")})},
+ *       columns={
+ *           @ColumnResult(name="item_name")}
+ *       )
+ * 
+ * + * @see SqlResultSetMapping + * + * @since Java Persistence 1.0 + */ +@Target({}) +@Retention(RUNTIME) + +public @interface ColumnResult { + + /** (Required) The name of a column in the SELECT clause of a SQL query */ + String name(); + + /** + * (Optional) The Java type to which the column type is to be mapped. + * If the type element is not specified, the default JDBC type + * mapping for the column will be used. + * @since Java Persistence 2.1 + */ + Class type() default void.class; +} Index: 3rdParty_sources/persistence-api/javax/persistence/ConstraintMode.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ConstraintMode.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ConstraintMode.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 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 + * + ******************************************************************************/ +package javax.persistence; + +/** + * Used to control the application of a constraint. + * + * @since Java Persistence 2.1 + */ +public enum ConstraintMode { + + /** Apply the constraint. */ + CONSTRAINT, + + /** Do not apply the constraint. */ + NO_CONSTRAINT, + + /** Use the provider-defined default behavior. */ + PROVIDER_DEFAULT +} Index: 3rdParty_sources/persistence-api/javax/persistence/ConstructorResult.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ConstructorResult.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ConstructorResult.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,81 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Used in conjunction with the {@link SqlResultSetMapping} annotation to map the SELECT + * clause of a SQL query to a constructor. + * + *

Applies a constructor for the target class, passing in as arguments + * values from the specified columns. All columns corresponding + * to arguments of the intended constructor must be specified using the + * columns element of the ConstructorResult + * annotation in the same order as that of the argument list of the + * constructor. Any entities returned as constructor results will be + * in either the new or detached state, depending on whether a primary + * key is retrieved for the constructed object. + * + *

+ *
+ * Example:
+ *
+ *   Query q = em.createNativeQuery(
+ *      "SELECT c.id, c.name, COUNT(o) as orderCount, AVG(o.price) AS avgOrder " +
+ *      "FROM Customer c, Orders o " +
+ *      "WHERE o.cid = c.id " +
+ *      "GROUP BY c.id, c.name",
+ *      "CustomerDetailsResult");
+ *
+ *   @SqlResultSetMapping(
+ *       name="CustomerDetailsResult",
+ *       classes={
+ *          @ConstructorResult(
+ *               targetClass=com.acme.CustomerDetails.class,
+ *                 columns={
+ *                    @ColumnResult(name="id"),
+ *                    @ColumnResult(name="name"),
+ *                    @ColumnResult(name="orderCount"),
+ *                    @ColumnResult(name="avgOrder", type=Double.class)
+ *                    }
+ *          )
+ *       }
+ *      )
+ *
+ * 
+ * + * @see SqlResultSetMapping + * @see ColumnResult + * + * @since Java Persistence 2.1 + */ +@Target({}) +@Retention(RUNTIME) + +public @interface ConstructorResult { + + /** (Required) The class whose constructor is to be invoked. */ + Class targetClass(); + + /** + * (Required) The mapping of columns in the SELECT list to the arguments + * of the intended constructor, in order. + */ + ColumnResult[] columns(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/Convert.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Convert.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Convert.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,211 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the conversion of a Basic field or property. It is + * not necessary to use the Basic annotation or corresponding + * XML element to specify the Basic type. + * + *

The Convert annotation should not be used to specify + * conversion of the following: Id attributes, version attributes, + * relationship attributes, and attributes explicitly denoted as + * Enumerated or Temporal. Applications that specify such conversions + * will not be portable. + * + *

The Convert annotation may be applied to a basic + * attribute or to an element collection of basic type (in which case + * the converter is applied to the elements of the collection). In + * these cases, the attributeName element must not be + * specified. + * + *

The Convert annotation may be applied to an embedded + * attribute or to a map collection attribute whose key or value is of + * embeddable type (in which case the converter is applied to the + * specified attribute of the embeddable instances contained in the + * collection). In these cases, the attributeName + * element must be specified. + * + *

To override conversion mappings at multiple levels of embedding, + * a dot (".") notation form must be used in the attributeName + * element to indicate an attribute within an embedded attribute. The + * value of each identifier used with the dot notation is the name of the + * respective embedded field or property. + * + *

When the Convert annotation is applied to a map containing + * instances of embeddable classes, the attributeName element + * must be specified, and "key." or "value." + * must be used to prefix the name of the attribute that is to be converted + * in order to specify it as part of the map key or map value. + * + *

When the Convert annotation is applied to a map to specify + * conversion of a map key of basic type, "key" must be used + * as the value of the attributeName element to specify that + * it is the map key that is to be converted. + * + *

The Convert annotation may be applied to an entity class + * that extends a mapped superclass to specify or override a conversion + * mapping for an inherited basic or embedded attribute. + * + *

+ *     Example 1:  Convert a basic attribute
+ *
+ *     @Converter
+ *     public class BooleanToIntegerConverter 
+ *        implements AttributeConverter<Boolean, Integer> {  ... }
+ *
+ *     @Entity
+ *     public class Employee {
+ *         @Id long id;
+ *
+ *         @Convert(converter=BooleanToIntegerConverter.class)
+ *          boolean fullTime;
+ *          ...
+ *     }
+ *
+ *
+ *     Example 2:  Auto-apply conversion of a basic attribute
+ *
+ *     @Converter(autoApply=true)
+ *     public class EmployeeDateConverter 
+ *        implements AttributeConverter<com.acme.EmployeeDate, java.sql.Date> {  ... }
+ *
+ *     @Entity
+ *     public class Employee {
+ *         @Id long id;
+ *         ...
+ *         // EmployeeDateConverter is applied automatically
+ *         EmployeeDate startDate;
+ *     }
+ *
+ *
+ *     Example 3:  Disable conversion in the presence of an autoapply converter
+ *
+ *     @Convert(disableConversion=true)
+ *     EmployeeDate lastReview;
+ *
+ *
+ *     Example 4:  Apply a converter to an element collection of basic type
+ *
+ *     @ElementCollection
+ *     // applies to each element in the collection
+ *     @Convert(converter=NameConverter.class) 
+ *     List<String> names;
+ *
+ *
+ *     Example 5:  Apply a converter to an element collection that is a map or basic values.  
+ *                 The converter is applied to the map value.
+ *
+ *     @ElementCollection
+ *     @Convert(converter=EmployeeNameConverter.class)
+ *     Map<String, String> responsibilities;
+ *
+ *
+ *     Example 6:  Apply a converter to a map key of basic type
+ *
+ *     @OneToMany
+ *     @Convert(converter=ResponsibilityCodeConverter.class, 
+ *              attributeName="key")
+ *     Map<String, Employee> responsibilities;
+ *
+ *
+ *     Example 7:  Apply a converter to an embeddable attribute
+ *
+ *     @Embedded
+ *     @Convert(converter=CountryConverter.class, 
+ *              attributeName="country")
+ *     Address address;
+ * 
+ *
+ *     Example 8:  Apply a converter to a nested embeddable attribute
+ * 
+ *     @Embedded
+ *     @Convert(converter=CityConverter.class, 
+ *              attributeName="region.city")
+ *     Address address;
+ *
+ *
+ *     Example 9:  Apply a converter to a nested attribute of an embeddable that is a map key 
+ *                 of an element collection
+ *
+ *     @Entity public class PropertyRecord {
+ *          ...
+ *         @Convert(attributeName="key.region.city", 
+ *                  converter=CityConverter.class)
+ *         @ElementCollection
+ *         Map<Address, PropertyInfo> parcels;
+ *     }
+ *
+ *
+ *     Example 10: Apply a converter to an embeddable that is a map key for a relationship
+ *
+ *     @OneToMany
+ *     @Convert(attributeName="key.jobType", 
+ *              converter=ResponsibilityTypeConverter.class)
+ *     Map<Responsibility, Employee> responsibilities;
+ *
+ *
+ *     Example 11: Override conversion mappings for attributes inherited from a mapped superclass
+ *
+ *     @Entity
+ *         @Converts({
+ *            @Convert(attributeName="startDate", 
+ *                     converter=DateConverter.class),
+ *            @Convert(attributeName="endDate", 
+ *                     converter=DateConverter.class)})
+ *     public class FullTimeEmployee extends GenericEmployee { ... }
+ *  
+ * + * @see Converter + * @see Converts + * @see Basic + * + * @since Java Persistence 2.1 + */ +@Repeatable(Converts.class) +@Target({METHOD, FIELD, TYPE}) @Retention(RUNTIME) +public @interface Convert { + + /** + * Specifies the converter to be applied. A value for this + * element must be specified if multiple converters would + * otherwise apply. + */ + Class converter() default void.class; + + /** + * The attributeName element must be specified unless the + * Convert annotation is on an attribute of basic type + * or on an element collection of basic type. In these cases, the + * attributeName element must not be specified. + */ + String attributeName() default ""; + + /** + * Used to disable an auto-apply or inherited converter. + * If disableConversion is true, the converter element should + * not be specified. + */ + boolean disableConversion() default false; +} Index: 3rdParty_sources/persistence-api/javax/persistence/Converter.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Converter.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Converter.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ +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 that the annotated class is a converter and defines its + * scope. A converter class must be annotated with the Converter + * annotation or defined in the object/relational mapping descriptor as + * a converter. + * + *

If the autoApply element is specified as + * true, the persistence provider must automatically + * apply the converter to all mapped attributes of the specified + * target type for all entities in the persistence unit except for + * attributes for which conversion is overridden by means of the + * Convert annotation (or XML equivalent). + * + *

In determining whether a converter is applicable to an attribute, + * the provider must treat primitive types and wrapper types as + * equivalent. + * + *

Note that Id attributes, version attributes, relationship + * attributes, and attributes explicitly annotated as + * Enumerated or Temporal (or designated as + * such via XML) will not be converted. + * + *

Note that if autoApply is true, the + * Convert annotation may be used to override or disable + * auto-apply conversion on a per-attribute basis. + * + *

If autoApply is false, only those + * attributes of the target type for which the Convert + * annotation (or corresponding XML element) has been specified will + * be converted. + * + *

If there is more than one converter defined for the same target + * type, the Convert annotation should be used to + * explicitly specify which converter to use. + * + * @see AttributeConverter + * @see Convert + * + * @since Java Persistence 2.1 + */ +@Target({TYPE}) @Retention(RUNTIME) +public @interface Converter { + boolean autoApply() default false; +} Index: 3rdParty_sources/persistence-api/javax/persistence/Converts.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Converts.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Converts.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ +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.ElementType.METHOD; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to group Convert annotations. Multiple converters + * must not be applied to the same basic attribute. + * + * @see Convert + * @since Java Persistence 2.1 + */ +@Target({METHOD, FIELD, TYPE}) +@Retention(RUNTIME) +public @interface Converts { + + /** + * The Convert mappings that are to be applied. + * + */ + Convert[] value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/DiscriminatorColumn.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/DiscriminatorColumn.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/DiscriminatorColumn.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,84 @@ +/******************************************************************************* + * 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; +import static javax.persistence.DiscriminatorType.STRING; + +/** + * Specifies the discriminator column for the + * SINGLE_TABLE and + * JOINED {@link Inheritance} mapping strategies. + * + *

The strategy and the discriminator column are only + * specified in the root of an entity class hierarchy or + * subhierarchy in which a different inheritance strategy is applied + * + *

If the DiscriminatorColumn annotation is missing, + * and a discriminator column is required, the name of the + * discriminator column defaults to "DTYPE" and the discriminator + * type to {@link DiscriminatorType#STRING DiscriminatorType.STRING}. + * + *

+ *     Example:
+ *
+ *     @Entity
+ *     @Table(name="CUST")
+ *     @Inheritance(strategy=SINGLE_TABLE)
+ *     @DiscriminatorColumn(name="DISC", discriminatorType=STRING, length=20)
+ *     public class Customer { ... }
+ *
+ *     @Entity
+ *     public class ValuedCustomer extends Customer { ... }
+ * 
+ * + * @see DiscriminatorValue + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) + +public @interface DiscriminatorColumn { + + /** + * (Optional) The name of column to be used for the discriminator. + */ + String name() default "DTYPE"; + + /** + * (Optional) The type of object/column to use as a class discriminator. + * Defaults to {@link DiscriminatorType#STRING DiscriminatorType.STRING}. + */ + DiscriminatorType discriminatorType() default STRING; + + /** + * (Optional) The SQL fragment that is used when generating the DDL + * for the discriminator column. + *

Defaults to the provider-generated SQL to create a column + * of the specified discriminator type. + */ + String columnDefinition() default ""; + + /** + * (Optional) The column length for String-based discriminator types. + * Ignored for other discriminator types. + */ + int length() default 31; +} Index: 3rdParty_sources/persistence-api/javax/persistence/DiscriminatorType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/DiscriminatorType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/DiscriminatorType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,39 @@ +/******************************************************************************* + * 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 supported types of the discriminator column. + * + * @since Java Persistence 1.0 + */ +public enum DiscriminatorType { + + /** + * String as the discriminator type. + */ + STRING, + + /** + * Single character as the discriminator type. + */ + CHAR, + + /** + * Integer as the discriminator type. + */ + INTEGER +} Index: 3rdParty_sources/persistence-api/javax/persistence/DiscriminatorValue.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/DiscriminatorValue.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/DiscriminatorValue.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,81 @@ +/******************************************************************************* + * 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 value of the discriminator column for + * entities of the given type. + * + *

The DiscriminatorValue + * annotation can only be specified on a concrete entity + * class. + * + *

If the DiscriminatorValue annotation is not + * specified and a discriminator column is used, a provider-specific + * function will be used to generate a value representing the + * entity type. If the {@link DiscriminatorType} is + * STRING, the discriminator value + * default is the entity name. + * + *

The inheritance strategy and the discriminator column + * are only specified in the root of an entity class hierarchy + * or subhierarchy in which a different inheritance strategy is + * applied. The discriminator value, if not defaulted, should be + * specified for each entity class in the hierarchy. + * + *

+ *
+ *    Example:
+ *
+ *    @Entity
+ *    @Table(name="CUST")
+ *    @Inheritance(strategy=SINGLE_TABLE)
+ *    @DiscriminatorColumn(name="DISC", discriminatorType=STRING, length=20)
+ *    @DiscriminatorValue("CUSTOMER")
+ *    public class Customer { ... }
+ *
+ *    @Entity
+ *    @DiscriminatorValue("VCUSTOMER")
+ *    public class ValuedCustomer extends Customer { ... }
+ * 
+ * + * @see DiscriminatorColumn + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) + +public @interface DiscriminatorValue { + + /** + * (Optional) The value that indicates that the + * row is an entity of the annotated entity type. + * + *

If the DiscriminatorValue annotation is not + * specified and a discriminator column is used, a + * provider-specific function will be used to generate a value + * representing the entity type. If the DiscriminatorType is + * STRING, the discriminator value default is the + * entity name. + */ + String value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/ElementCollection.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ElementCollection.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ElementCollection.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,68 @@ +/******************************************************************************* + * 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; +import static javax.persistence.FetchType.LAZY; + +/** + * Specifies a collection of instances of a basic type or embeddable + * class. + * Must be specified if the collection is to be mapped by + * means of a collection table. + * + *

+ *    Example:
+ *
+ *    @Entity public class Person {
+ *       @Id protected String ssn;
+ *       protected String name;
+ *       ...
+ *       @ElementCollection  
+ *       protected Set<String> nickNames = new HashSet();
+ *         ...
+ *    } 
+ *  
+ * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface ElementCollection { + + /** + * (Optional) The basic or embeddable class that is the element + * type of the collection. This element is optional only if the + * collection field or property is defined using Java generics, + * and must be specified otherwise. It defaults to the + * paramterized type of the collection when defined using + * generics. + */ + Class targetClass() default void.class; + + /** + * (Optional) Whether the collection should be lazily loaded or must be + * eagerly fetched. The EAGER strategy is a requirement on + * the persistence provider runtime that the collection elements + * must be eagerly fetched. The LAZY strategy is a hint to the + * persistence provider runtime. + */ + FetchType fetch() default LAZY; +} Index: 3rdParty_sources/persistence-api/javax/persistence/Embeddable.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Embeddable.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Embeddable.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,80 @@ +/******************************************************************************* + * 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 a class whose instances are stored as an intrinsic + * part of an owning entity and share the identity of the entity. + * Each of the persistent properties or fields of the embedded + * object is mapped to the database table for the entity. + * + *

Note that the {@link Transient} annotation may be used to + * designate the non-persistent state of an embeddable class. + * + *

+ *
+ *    Example 1:
+ *
+ *    @Embeddable public class EmploymentPeriod { 
+ *       @Temporal(DATE) java.util.Date startDate;
+ *       @Temporal(DATE) java.util.Date endDate;
+ *      ... 
+ *    }
+ *
+ *    Example 2:
+ *
+ *    @Embeddable public class PhoneNumber {
+ *        protected String areaCode;
+ *        protected String localNumber;
+ *        @ManyToOne PhoneServiceProvider provider;
+ *        ...
+ *     }
+ *
+ *    @Entity public class PhoneServiceProvider {
+ *        @Id protected String name;
+ *         ...
+ *     }
+ *
+ *    Example 3:
+ *
+ *    @Embeddable public class Address {
+ *       protected String street;
+ *       protected String city;
+ *       protected String state;
+ *       @Embedded protected Zipcode zipcode;
+ *    }
+ *
+ *    @Embeddable public class Zipcode {
+ *       protected String zip;
+ *       protected String plusFour;
+ *     }
+
+
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Documented +@Target({TYPE}) +@Retention(RUNTIME) +public @interface Embeddable { +} Index: 3rdParty_sources/persistence-api/javax/persistence/Embedded.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Embedded.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Embedded.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,57 @@ +/******************************************************************************* + * 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 a persistent field or property of an entity whose + * value is an instance of an embeddable class. The embeddable + * class must be annotated as {@link Embeddable}. + * + *

The AttributeOverride, AttributeOverrides, + * AssociationOverride, and AssociationOverrides + * annotations may be used to override mappings declared or defaulted + * by the embeddable class. + * + *

+ *   Example:
+ *
+ *   @Embedded
+ *   @AttributeOverrides({
+ *       @AttributeOverride(name="startDate", column=@Column("EMP_START")),
+ *       @AttributeOverride(name="endDate", column=@Column("EMP_END"))
+ *   })
+ *   public EmploymentPeriod getEmploymentPeriod() { ... }
+ * 
+ * + * @see Embeddable + * @see AttributeOverride + * @see AttributeOverrides + * @see AssociationOverride + * @see AssociationOverrides + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface Embedded { +} Index: 3rdParty_sources/persistence-api/javax/persistence/EmbeddedId.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EmbeddedId.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EmbeddedId.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,81 @@ +/******************************************************************************* + * 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; + +/** + * Applied to a persistent field or property of an entity + * class or mapped superclass to denote a composite primary + * key that is an embeddable class. The embeddable class + * must be annotated as {@link Embeddable}. + * + *

There must be only one EmbeddedId annotation and + * no Id annotation when the EmbeddedId annotation is used. + * + *

The {@link AttributeOverride} annotation may be used to override + * the column mappings declared within the embeddable class. + * + *

The {@link MapsId} annotation may be used in conjunction + * with the EmbeddedId annotation to specify a derived + * primary key. + * + *

If the entity has a derived primary key, the + * AttributeOverride annotation may only be used to + * override those attributes of the embedded id that do not correspond + * to the relationship to the parent entity. + * + *

Relationship mappings defined within an embedded id class are not supported. + * + *

+ *    Example 1:
+ *
+ *    @EmbeddedId
+ *    protected EmployeePK empPK;
+ *
+ *
+ *    Example 2:
+ *
+ *    @Embeddable
+ *    public class DependentId {
+ *       String name;
+ *       EmployeeId empPK;   // corresponds to primary key type of Employee
+ *    }
+ *
+ *    @Entity
+ *    public class Dependent {
+ *       // default column name for "name" attribute is overridden
+ *       @AttributeOverride(name="name", @Column(name="dep_name"))
+ *       @EmbeddedId DependentId id;
+ *       ...
+ *       @MapsId("empPK")
+ *       @ManyToOne Employee emp;
+ *    }
+ * 
+ * + * @see Embeddable + * @see MapsId + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface EmbeddedId {} Index: 3rdParty_sources/persistence-api/javax/persistence/Entity.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Entity.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Entity.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,42 @@ +/******************************************************************************* + * 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. + */ + String name() default ""; +} Index: 3rdParty_sources/persistence-api/javax/persistence/EntityExistsException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EntityExistsException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EntityExistsException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,77 @@ +/******************************************************************************* + * 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; + +/** + * Thrown by the persistence provider when {@link EntityManager#persist(Object) + * EntityManager.persist(Object)} is called and the entity already exists. The + * current transaction, if one is active, will be marked for rollback. + *

+ * If the entity already exists, the EntityExistsException may be thrown when + * the persist operation is invoked, or the EntityExistsException or another + * PersistenceException may be thrown at flush or commit time. + *

The current transaction, if one is active and the persistence context + * has been joined to it, will be marked for rollback. + * + * @see javax.persistence.EntityManager#persist(Object) + * + * @since Java Persistence 1.0 + */ +public class EntityExistsException extends PersistenceException { + + /** + * Constructs a new EntityExistsException exception with + * null as its detail message. + */ + public EntityExistsException() { + super(); + } + + /** + * Constructs a new EntityExistsException exception with the + * specified detail message. + * + * @param message + * the detail message. + */ + public EntityExistsException(String message) { + super(message); + } + + /** + * Constructs a new EntityExistsException exception with the + * specified detail message and cause. + * + * @param message + * the detail message. + * @param cause + * the cause. + */ + public EntityExistsException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new EntityExistsException exception with the + * specified cause. + * + * @param cause + * the cause. + */ + public EntityExistsException(Throwable cause) { + super(cause); + } +} Index: 3rdParty_sources/persistence-api/javax/persistence/EntityGraph.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EntityGraph.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EntityGraph.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,226 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ + +package javax.persistence; + +import javax.persistence.metamodel.Attribute; +import java.util.List; + +/** + * This type represents the root of an entity graph that will be used + * as a template to define the attribute nodes and boundaries of a + * graph of entities and entity relationships. The root must be an + * entity type. + *

+ * The methods to add subgraphs implicitly create the + * corresponding attribute nodes as well; such attribute nodes + * should not be redundantly specified. + * + * @param The type of the root entity. + * + * @see AttributeNode + * @see Subgraph + * @see NamedEntityGraph + * + * @since Java Persistence 2.1 + */ +public interface EntityGraph { + + /** + * Return the name of a named EntityGraph (an entity graph + * defined by means of the NamedEntityGraph + * annotation, XML descriptor element, or added by means of the + * addNamedEntityGraph method. Returns null if the + * EntityGraph is not a named EntityGraph. + */ + public String getName(); + + /** + * Add one or more attribute nodes to the entity graph. + * + * @param attributeName name of the attribute + * @throws IllegalArgumentException if the attribute is not an + * attribute of this entity. + * @throws IllegalStateException if the EntityGraph has been + * statically defined + */ + public void addAttributeNodes(String ... attributeName); + + /** + * Add one or more attribute nodes to the entity graph. + * + * @param attribute attribute + * @throws IllegalStateException if the EntityGraph has been + * statically defined + */ + public void addAttributeNodes(Attribute ... attribute); + + /** + * Add a node to the graph that corresponds to a managed + * type. This allows for construction of multi-node entity graphs + * that include related managed types. + * + * @param attribute attribute + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute's target type + * is not a managed type + * @throws IllegalStateException if the EntityGraph has been + * statically defined + */ + public Subgraph addSubgraph(Attribute attribute); + + /** + * Add a node to the graph that corresponds to a managed + * type with inheritance. This allows for multiple subclass + * subgraphs to be defined for this node of the entity + * graph. Subclass subgraphs will automatically include the + * specified attributes of superclass subgraphs. + * + * @param attribute attribute + * @param type entity subclass + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute's target + * type is not a managed type + * @throws IllegalStateException if the EntityGraph has been + * statically defined + */ + public Subgraph addSubgraph(Attribute attribute, Class type); + + /** + * Add a node to the graph that corresponds to a managed + * type. This allows for construction of multi-node entity graphs + * that include related managed types. + * + * @param attributeName name of the attribute + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute is not an + * attribute of this entity. + * @throws IllegalArgumentException if the attribute's target type + * is not a managed type + * @throws IllegalStateException if the EntityGraph has been + * statically defined + */ + public Subgraph addSubgraph(String attributeName); + + /** + * Add a node to the graph that corresponds to a managed + * type with inheritance. This allows for multiple subclass + * subgraphs to be defined for this node of the entity graph. + * Subclass subgraphs will automatically include the specified + * attributes of superclass subgraphs. + * + * @param attributeName name of the attribute + * @param type entity subclass + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute is not an + * attribute of this managed type. + * @throws IllegalArgumentException if the attribute's target type + * is not a managed type + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addSubgraph(String attributeName, Class type); + + /** + * Add a node to the graph that corresponds to a map key + * that is a managed type. This allows for construction of + * multi-node entity graphs that include related managed types. + * + * @param attribute attribute + * @return subgraph for the key attribute + * @throws IllegalArgumentException if the attribute's target type + * is not an entity + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addKeySubgraph(Attribute attribute); + + /** + * Add a node to the graph that corresponds to a map key + * that is a managed type with inheritance. This allows for + * construction of multi-node entity graphs that include related + * managed types. Subclass subgraphs will include the specified + * attributes of superclass subgraphs. + * + * @param attribute attribute + * @param type entity subclass + * @return subgraph for the key attribute + * @throws IllegalArgumentException if the attribute's target type + * is not an entity + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addKeySubgraph(Attribute attribute, Class type); + + /** + * Add a node to the graph that corresponds to a map key + * that is a managed type. This allows for construction of + * multi-node entity graphs that include related managed types. + * + * @param attributeName name of the attribute + * @return subgraph for the key attribute + * @throws IllegalArgumentException if the attribute is not an + * attribute of this entity. + * @throws IllegalArgumentException if the attribute's target type + * is not an entity + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addKeySubgraph(String attributeName); + + /** + * Add a node to the graph that corresponds to a map key + * that is a managed type with inheritance. This allows for + * construction of multi-node entity graphs that include related + * managed types. Subclass subgraphs will automatically include + * the specified attributes of superclass subgraphs + * + * @param attributeName name of the attribute + * @param type entity subclass + * @return subgraph for the key attribute + * @throws IllegalArgumentException if the attribute is not an + * attribute of this entity. + * @throws IllegalArgumentException if the attribute's target type + * is not a managed type + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addKeySubgraph(String attributeName, Class type); + + + /** + * Add additional attributes to this entity graph that + * correspond to attributes of subclasses of this EntityGraph's + * entity type. Subclass subgraphs will automatically include the + * specified attributes of superclass subgraphs. + * + * @param type entity subclass + * @return subgraph for the subclass + * @throws IllegalArgumentException if the type is not an entity type + * @throws IllegalStateException if the EntityGraph has been + * statically defined + */ + public Subgraph addSubclassSubgraph(Class type); + + + /** + * Return the attribute nodes of this entity that are included in + * the entity graph. + * @return attribute nodes for the annotated entity type or empty + * list if none have been defined + */ + public List> getAttributeNodes(); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/EntityListeners.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EntityListeners.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EntityListeners.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,36 @@ +/******************************************************************************* + * 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 callback listener classes to be used for an + * entity or mapped superclass. This annotation may be applied + * to an entity class or mapped superclass. + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface EntityListeners { + + /** The callback listener classes */ + Class[] value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/EntityManager.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EntityManager.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EntityManager.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,895 @@ +/******************************************************************************* + * 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.util.Map; +import java.util.List; +import javax.persistence.metamodel.Metamodel; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.CriteriaUpdate; +import javax.persistence.criteria.CriteriaDelete; + +/** + * Interface used to interact with the persistence context. + * + *

An EntityManager instance is associated with + * a persistence context. A persistence context is a set of entity + * instances in which for any persistent entity identity there is + * a unique entity instance. Within the persistence context, the + * entity instances and their lifecycle are managed. + * The EntityManager API is used + * to create and remove persistent entity instances, to find entities + * by their primary key, and to query over entities. + * + *

The set of entities that can be managed by a given + * EntityManager instance is defined by a persistence + * unit. A persistence unit defines the set of all classes that are + * related or grouped by the application, and which must be + * colocated in their mapping to a single database. + * + * @see Query + * @see TypedQuery + * @see CriteriaQuery + * @see PersistenceContext + * @see StoredProcedureQuery + * + * @since Java Persistence 1.0 + */ +public interface EntityManager { + + /** + * Make an instance managed and persistent. + * @param entity entity instance + * @throws EntityExistsException if the entity already exists. + * (If the entity already exists, the EntityExistsException may + * be thrown when the persist operation is invoked, or the + * EntityExistsException or another PersistenceException may be + * thrown at flush or commit time.) + * @throws IllegalArgumentException if the instance is not an + * entity + * @throws TransactionRequiredException if there is no transaction when + * invoked on a container-managed entity manager of that is of type + * PersistenceContextType.TRANSACTION + */ + public void persist(Object entity); + + /** + * Merge the state of the given entity into the + * current persistence context. + * @param entity entity instance + * @return the managed instance that the state was merged to + * @throws IllegalArgumentException if instance is not an + * entity or is a removed entity + * @throws TransactionRequiredException if there is no transaction when + * invoked on a container-managed entity manager of that is of type + * PersistenceContextType.TRANSACTION + */ + public T merge(T entity); + + /** + * Remove the entity instance. + * @param entity entity instance + * @throws IllegalArgumentException if the instance is not an + * entity or is a detached entity + * @throws TransactionRequiredException if invoked on a + * container-managed entity manager of type + * PersistenceContextType.TRANSACTION and there is + * no transaction + */ + public void remove(Object entity); + + /** + * Find by primary key. + * Search for an entity of the specified class and primary key. + * If the entity instance is contained in the persistence context, + * it is returned from there. + * @param entityClass entity class + * @param primaryKey primary key + * @return the found entity instance or null if the entity does + * not exist + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * is not a valid type for that entity's primary key or + * is null + */ + public T find(Class entityClass, Object primaryKey); + + /** + * Find by primary key, using the specified properties. + * Search for an entity of the specified class and primary key. + * If the entity instance is contained in the persistence + * context, it is returned from there. + * If a vendor-specific property or hint is not recognized, + * it is silently ignored. + * @param entityClass entity class + * @param primaryKey primary key + * @param properties standard and vendor-specific properties + * and hints + * @return the found entity instance or null if the entity does + * not exist + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * is not a valid type for that entity's primary key or + * is null + * @since Java Persistence 2.0 + */ + public T find(Class entityClass, Object primaryKey, + Map properties); + + /** + * Find by primary key and lock. + * Search for an entity of the specified class and primary key + * and lock it with respect to the specified lock type. + * If the entity instance is contained in the persistence context, + * it is returned from there, and the effect of this method is + * the same as if the lock method had been called on the entity. + *

If the entity is found within the persistence context and the + * lock mode type is pessimistic and the entity has a version + * attribute, the persistence provider must perform optimistic + * version checks when obtaining the database lock. If these + * checks fail, the OptimisticLockException will be thrown. + *

If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

    + *
  • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
  • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
+ * @param entityClass entity class + * @param primaryKey primary key + * @param lockMode lock mode + * @return the found entity instance or null if the entity does + * not exist + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * not a valid type for that entity's primary key or + * is null + * @throws TransactionRequiredException if there is no + * transaction and a lock mode other than NONE is + * specified or if invoked on an entity manager which has + * not been joined to the current transaction and a lock + * mode other than NONE is specified + * @throws OptimisticLockException if the optimistic version + * check fails + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public T find(Class entityClass, Object primaryKey, + LockModeType lockMode); + + /** + * Find by primary key and lock, using the specified properties. + * Search for an entity of the specified class and primary key + * and lock it with respect to the specified lock type. + * If the entity instance is contained in the persistence context, + * it is returned from there. + *

If the entity is found + * within the persistence context and the lock mode type + * is pessimistic and the entity has a version attribute, the + * persistence provider must perform optimistic version checks + * when obtaining the database lock. If these checks fail, + * the OptimisticLockException will be thrown. + *

If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

    + *
  • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
  • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
+ *

If a vendor-specific property or hint is not recognized, + * it is silently ignored. + *

Portable applications should not rely on the standard timeout + * hint. Depending on the database in use and the locking + * mechanisms used by the provider, the hint may or may not + * be observed. + * @param entityClass entity class + * @param primaryKey primary key + * @param lockMode lock mode + * @param properties standard and vendor-specific properties + * and hints + * @return the found entity instance or null if the entity does + * not exist + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * not a valid type for that entity's primary key or + * is null + * @throws TransactionRequiredException if there is no + * transaction and a lock mode other than NONE is + * specified or if invoked on an entity manager which has + * not been joined to the current transaction and a lock + * mode other than NONE is specified + * @throws OptimisticLockException if the optimistic version + * check fails + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public T find(Class entityClass, Object primaryKey, + LockModeType lockMode, + Map properties); + + /** + * Get an instance, whose state may be lazily fetched. + * If the requested instance does not exist in the database, + * the EntityNotFoundException is thrown when the instance + * state is first accessed. (The persistence provider runtime is + * permitted to throw the EntityNotFoundException when + * getReference is called.) + * The application should not expect that the instance state will + * be available upon detachment, unless it was accessed by the + * application while the entity manager was open. + * @param entityClass entity class + * @param primaryKey primary key + * @return the found entity instance + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * not a valid type for that entity's primary key or + * is null + * @throws EntityNotFoundException if the entity state + * cannot be accessed + */ + public T getReference(Class entityClass, + Object primaryKey); + + /** + * Synchronize the persistence context to the + * underlying database. + * @throws TransactionRequiredException if there is + * no transaction or if the entity manager has not been + * joined to the current transaction + * @throws PersistenceException if the flush fails + */ + public void flush(); + + /** + * Set the flush mode that applies to all objects contained + * in the persistence context. + * @param flushMode flush mode + */ + public void setFlushMode(FlushModeType flushMode); + + /** + * Get the flush mode that applies to all objects contained + * in the persistence context. + * @return flushMode + */ + public FlushModeType getFlushMode(); + + /** + * Lock an entity instance that is contained in the persistence + * context with the specified lock mode type. + *

If a pessimistic lock mode type is specified and the entity + * contains a version attribute, the persistence provider must + * also perform optimistic version checks when obtaining the + * database lock. If these checks fail, the + * OptimisticLockException will be thrown. + *

If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

    + *
  • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
  • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
+ * @param entity entity instance + * @param lockMode lock mode + * @throws IllegalArgumentException if the instance is not an + * entity or is a detached entity + * @throws TransactionRequiredException if there is no + * transaction or if invoked on an entity manager which + * has not been joined to the current transaction + * @throws EntityNotFoundException if the entity does not exist + * in the database when pessimistic locking is + * performed + * @throws OptimisticLockException if the optimistic version + * check fails + * @throws PessimisticLockException if pessimistic locking fails + * and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + */ + public void lock(Object entity, LockModeType lockMode); + + /** + * Lock an entity instance that is contained in the persistence + * context with the specified lock mode type and with specified + * properties. + *

If a pessimistic lock mode type is specified and the entity + * contains a version attribute, the persistence provider must + * also perform optimistic version checks when obtaining the + * database lock. If these checks fail, the + * OptimisticLockException will be thrown. + *

If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

    + *
  • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
  • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
+ *

If a vendor-specific property or hint is not recognized, + * it is silently ignored. + *

Portable applications should not rely on the standard timeout + * hint. Depending on the database in use and the locking + * mechanisms used by the provider, the hint may or may not + * be observed. + * @param entity entity instance + * @param lockMode lock mode + * @param properties standard and vendor-specific properties + * and hints + * @throws IllegalArgumentException if the instance is not an + * entity or is a detached entity + * @throws TransactionRequiredException if there is no + * transaction or if invoked on an entity manager which + * has not been joined to the current transaction + * @throws EntityNotFoundException if the entity does not exist + * in the database when pessimistic locking is + * performed + * @throws OptimisticLockException if the optimistic version + * check fails + * @throws PessimisticLockException if pessimistic locking fails + * and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public void lock(Object entity, LockModeType lockMode, + Map properties); + + /** + * Refresh the state of the instance from the database, + * overwriting changes made to the entity, if any. + * @param entity entity instance + * @throws IllegalArgumentException if the instance is not + * an entity or the entity is not managed + * @throws TransactionRequiredException if there is no + * transaction when invoked on a container-managed + * entity manager of type PersistenceContextType.TRANSACTION + * @throws EntityNotFoundException if the entity no longer + * exists in the database + */ + public void refresh(Object entity); + + /** + * Refresh the state of the instance from the database, using + * the specified properties, and overwriting changes made to + * the entity, if any. + *

If a vendor-specific property or hint is not recognized, + * it is silently ignored. + * @param entity entity instance + * @param properties standard and vendor-specific properties + * and hints + * @throws IllegalArgumentException if the instance is not + * an entity or the entity is not managed + * @throws TransactionRequiredException if there is no + * transaction when invoked on a container-managed + * entity manager of type PersistenceContextType.TRANSACTION + * @throws EntityNotFoundException if the entity no longer + * exists in the database + * @since Java Persistence 2.0 + */ + public void refresh(Object entity, + Map properties); + + /** + * Refresh the state of the instance from the database, + * overwriting changes made to the entity, if any, and + * lock it with respect to given lock mode type. + *

If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

    + *
  • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
  • the LockTimeoutException will be thrown if the + * database locking failure causes only statement-level + * rollback. + *
+ * @param entity entity instance + * @param lockMode lock mode + * @throws IllegalArgumentException if the instance is not + * an entity or the entity is not managed + * @throws TransactionRequiredException if invoked on a + * container-managed entity manager of type + * PersistenceContextType.TRANSACTION when there is + * no transaction; if invoked on an extended entity manager when + * there is no transaction and a lock mode other than NONE + * has been specified; or if invoked on an extended entity manager + * that has not been joined to the current transaction and a + * lock mode other than NONE has been specified + * @throws EntityNotFoundException if the entity no longer exists + * in the database + * @throws PessimisticLockException if pessimistic locking fails + * and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public void refresh(Object entity, LockModeType lockMode); + + /** + * Refresh the state of the instance from the database, + * overwriting changes made to the entity, if any, and + * lock it with respect to given lock mode type and with + * specified properties. + *

If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

    + *
  • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
  • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
+ *

If a vendor-specific property or hint is not recognized, + * it is silently ignored. + *

Portable applications should not rely on the standard timeout + * hint. Depending on the database in use and the locking + * mechanisms used by the provider, the hint may or may not + * be observed. + * @param entity entity instance + * @param lockMode lock mode + * @param properties standard and vendor-specific properties + * and hints + * @throws IllegalArgumentException if the instance is not + * an entity or the entity is not managed + * @throws TransactionRequiredException if invoked on a + * container-managed entity manager of type + * PersistenceContextType.TRANSACTION when there is + * no transaction; if invoked on an extended entity manager when + * there is no transaction and a lock mode other than NONE + * has been specified; or if invoked on an extended entity manager + * that has not been joined to the current transaction and a + * lock mode other than NONE has been specified + * @throws EntityNotFoundException if the entity no longer exists + * in the database + * @throws PessimisticLockException if pessimistic locking fails + * and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public void refresh(Object entity, LockModeType lockMode, + Map properties); + + /** + * Clear the persistence context, causing all managed + * entities to become detached. Changes made to entities that + * have not been flushed to the database will not be + * persisted. + */ + public void clear(); + + /** + * Remove the given entity from the persistence context, causing + * a managed entity to become detached. Unflushed changes made + * to the entity if any (including removal of the entity), + * will not be synchronized to the database. Entities which + * previously referenced the detached entity will continue to + * reference it. + * @param entity entity instance + * @throws IllegalArgumentException if the instance is not an + * entity + * @since Java Persistence 2.0 + */ + public void detach(Object entity); + + /** + * Check if the instance is a managed entity instance belonging + * to the current persistence context. + * @param entity entity instance + * @return boolean indicating if entity is in persistence context + * @throws IllegalArgumentException if not an entity + */ + public boolean contains(Object entity); + + /** + * Get the current lock mode for the entity instance. + * @param entity entity instance + * @return lock mode + * @throws TransactionRequiredException if there is no + * transaction or if the entity manager has not been + * joined to the current transaction + * @throws IllegalArgumentException if the instance is not a + * managed entity and a transaction is active + * @since Java Persistence 2.0 + */ + public LockModeType getLockMode(Object entity); + + /** + * Set an entity manager property or hint. + * If a vendor-specific property or hint is not recognized, it is + * silently ignored. + * @param propertyName name of property or hint + * @param value value for property or hint + * @throws IllegalArgumentException if the second argument is + * not valid for the implementation + * @since Java Persistence 2.0 + */ + public void setProperty(String propertyName, Object value); + + /** + * Get the properties and hints and associated values that are in effect + * for the entity manager. Changing the contents of the map does + * not change the configuration in effect. + * @return map of properties and hints in effect for entity manager + * @since Java Persistence 2.0 + */ + public Map getProperties(); + + /** + * Create an instance of Query for executing a + * Java Persistence query language statement. + * @param qlString a Java Persistence query string + * @return the new query instance + * @throws IllegalArgumentException if the query string is + * found to be invalid + */ + public Query createQuery(String qlString); + + /** + * Create an instance of TypedQuery for executing a + * criteria query. + * @param criteriaQuery a criteria query object + * @return the new query instance + * @throws IllegalArgumentException if the criteria query is + * found to be invalid + * @since Java Persistence 2.0 + */ + public TypedQuery createQuery(CriteriaQuery criteriaQuery); + + /** + * Create an instance of Query for executing a criteria + * update query. + * @param updateQuery a criteria update query object + * @return the new query instance + * @throws IllegalArgumentException if the update query is + * found to be invalid + * @since Java Persistence 2.1 + */ + public Query createQuery(CriteriaUpdate updateQuery); + + /** + * Create an instance of Query for executing a criteria + * delete query. + * @param deleteQuery a criteria delete query object + * @return the new query instance + * @throws IllegalArgumentException if the delete query is + * found to be invalid + * @since Java Persistence 2.1 + */ + public Query createQuery(CriteriaDelete deleteQuery); + + /** + * Create an instance of TypedQuery for executing a + * Java Persistence query language statement. + * The select list of the query must contain only a single + * item, which must be assignable to the type specified by + * the resultClass argument. + * @param qlString a Java Persistence query string + * @param resultClass the type of the query result + * @return the new query instance + * @throws IllegalArgumentException if the query string is found + * to be invalid or if the query result is found to + * not be assignable to the specified type + * @since Java Persistence 2.0 + */ + public TypedQuery createQuery(String qlString, Class resultClass); + + /** + * Create an instance of Query for executing a named query + * (in the Java Persistence query language or in native SQL). + * @param name the name of a query defined in metadata + * @return the new query instance + * @throws IllegalArgumentException if a query has not been + * defined with the given name or if the query string is + * found to be invalid + */ + public Query createNamedQuery(String name); + + /** + * Create an instance of TypedQuery for executing a + * Java Persistence query language named query. + * The select list of the query must contain only a single + * item, which must be assignable to the type specified by + * the resultClass argument. + * @param name the name of a query defined in metadata + * @param resultClass the type of the query result + * @return the new query instance + * @throws IllegalArgumentException if a query has not been + * defined with the given name or if the query string is + * found to be invalid or if the query result is found to + * not be assignable to the specified type + * @since Java Persistence 2.0 + */ + public TypedQuery createNamedQuery(String name, Class resultClass); + + /** + * Create an instance of Query for executing + * a native SQL statement, e.g., for update or delete. + * If the query is not an update or delete query, query + * execution will result in each row of the SQL result + * being returned as a result of type Object[] (or a result + * of type Object if there is only one column in the select + * list.) Column values are returned in the order of their + * appearance in the select list and default JDBC type + * mappings are applied. + * @param sqlString a native SQL query string + * @return the new query instance + */ + public Query createNativeQuery(String sqlString); + + /** + * Create an instance of Query for executing + * a native SQL query. + * @param sqlString a native SQL query string + * @param resultClass the class of the resulting instance(s) + * @return the new query instance + */ + public Query createNativeQuery(String sqlString, Class resultClass); + + /** + * Create an instance of Query for executing + * a native SQL query. + * @param sqlString a native SQL query string + * @param resultSetMapping the name of the result set mapping + * @return the new query instance + */ + public Query createNativeQuery(String sqlString, String resultSetMapping); + + /** + * Create an instance of StoredProcedureQuery for executing a + * stored procedure in the database. + *

Parameters must be registered before the stored procedure can + * be executed. + *

If the stored procedure returns one or more result sets, + * any result set will be returned as a list of type Object[]. + * @param name name assigned to the stored procedure query + * in metadata + * @return the new stored procedure query instance + * @throws IllegalArgumentException if a query has not been + * defined with the given name + * @since Java Persistence 2.1 + */ + public StoredProcedureQuery createNamedStoredProcedureQuery(String name); + + /** + * Create an instance of StoredProcedureQuery for executing a + * stored procedure in the database. + *

Parameters must be registered before the stored procedure can + * be executed. + *

If the stored procedure returns one or more result sets, + * any result set will be returned as a list of type Object[]. + * @param procedureName name of the stored procedure in the + * database + * @return the new stored procedure query instance + * @throws IllegalArgumentException if a stored procedure of the + * given name does not exist (or the query execution will + * fail) + * @since Java Persistence 2.1 + */ + public StoredProcedureQuery createStoredProcedureQuery(String procedureName); + + /** + * Create an instance of StoredProcedureQuery for executing a + * stored procedure in the database. + *

Parameters must be registered before the stored procedure can + * be executed. + *

The resultClass arguments must be specified in the order in + * which the result sets will be returned by the stored procedure + * invocation. + * @param procedureName name of the stored procedure in the + * database + * @param resultClasses classes to which the result sets + * produced by the stored procedure are to + * be mapped + * @return the new stored procedure query instance + * @throws IllegalArgumentException if a stored procedure of the + * given name does not exist (or the query execution will + * fail) + * @since Java Persistence 2.1 + */ + public StoredProcedureQuery createStoredProcedureQuery( + String procedureName, Class... resultClasses); + + /** + * Create an instance of StoredProcedureQuery for executing a + * stored procedure in the database. + *

Parameters must be registered before the stored procedure can + * be executed. + *

The resultSetMapping arguments must be specified in the order + * in which the result sets will be returned by the stored + * procedure invocation. + * @param procedureName name of the stored procedure in the + * database + * @param resultSetMappings the names of the result set mappings + * to be used in mapping result sets + * returned by the stored procedure + * @return the new stored procedure query instance + * @throws IllegalArgumentException if a stored procedure or + * result set mapping of the given name does not exist + * (or the query execution will fail) + */ + public StoredProcedureQuery createStoredProcedureQuery( + String procedureName, String... resultSetMappings); + + /** + * Indicate to the entity manager that a JTA transaction is + * active and join the persistence context to it. + *

This method should be called on a JTA application + * managed entity manager that was created outside the scope + * of the active transaction or on an entity manager of type + * SynchronizationType.UNSYNCHRONIZED to associate + * it with the current JTA transaction. + * @throws TransactionRequiredException if there is + * no transaction + */ + public void joinTransaction(); + + /** + * Determine whether the entity manager is joined to the + * current transaction. Returns false if the entity manager + * is not joined to the current transaction or if no + * transaction is active + * @return boolean + * @since Java Persistence 2.1 + */ + public boolean isJoinedToTransaction(); + + /** + * Return an object of the specified type to allow access to the + * provider-specific API. If the provider's EntityManager + * implementation does not support the specified class, the + * PersistenceException is thrown. + * @param cls the class of the object to be returned. This is + * normally either the underlying EntityManager implementation + * class or an interface that it implements. + * @return an instance of the specified class + * @throws PersistenceException if the provider does not + * support the call + * @since Java Persistence 2.0 + */ + public T unwrap(Class cls); + + /** + * Return the underlying provider object for the EntityManager, + * if available. The result of this method is implementation + * specific. + *

The unwrap method is to be preferred for new applications. + * @return underlying provider object for EntityManager + */ + public Object getDelegate(); + + /** + * Close an application-managed entity manager. + * After the close method has been invoked, all methods + * on the EntityManager instance and any + * Query, TypedQuery, and + * StoredProcedureQuery objects obtained from + * it will throw the IllegalStateException + * except for getProperties, + * getTransaction, and isOpen (which will return false). + * If this method is called when the entity manager is + * joined to an active transaction, the persistence + * context remains managed until the transaction completes. + * @throws IllegalStateException if the entity manager + * is container-managed + */ + public void close(); + + /** + * Determine whether the entity manager is open. + * @return true until the entity manager has been closed + */ + public boolean isOpen(); + + /** + * Return the resource-level EntityTransaction object. + * The EntityTransaction instance may be used serially to + * begin and commit multiple transactions. + * @return EntityTransaction instance + * @throws IllegalStateException if invoked on a JTA + * entity manager + */ + public EntityTransaction getTransaction(); + + /** + * Return the entity manager factory for the entity manager. + * @return EntityManagerFactory instance + * @throws IllegalStateException if the entity manager has + * been closed + * @since Java Persistence 2.0 + */ + public EntityManagerFactory getEntityManagerFactory(); + + /** + * Return an instance of CriteriaBuilder for the creation of + * CriteriaQuery objects. + * @return CriteriaBuilder instance + * @throws IllegalStateException if the entity manager has + * been closed + * @since Java Persistence 2.0 + */ + public CriteriaBuilder getCriteriaBuilder(); + + /** + * Return an instance of Metamodel interface for access to the + * metamodel of the persistence unit. + * @return Metamodel instance + * @throws IllegalStateException if the entity manager has + * been closed + * @since Java Persistence 2.0 + */ + public Metamodel getMetamodel(); + + /** + * Return a mutable EntityGraph that can be used to dynamically create an + * EntityGraph. + * @param rootType class of entity graph + * @return entity graph + * @since Java Persistence 2.1 + */ + public EntityGraph createEntityGraph(Class rootType); + + /** + * Return a mutable copy of the named EntityGraph. If there + * is no entity graph with the specified name, null is returned. + * @param graphName name of an entity graph + * @return entity graph + * @since Java Persistence 2.1 + */ + public EntityGraph createEntityGraph(String graphName); + + /** + * Return a named EntityGraph. The returned EntityGraph + * should be considered immutable. + * @param graphName name of an existing entity graph + * @return named entity graph + * @throws IllegalArgumentException if there is no EntityGraph of + * the given name + * @since Java Persistence 2.1 + */ + public EntityGraph getEntityGraph(String graphName); + + /** + * Return all named EntityGraphs that have been defined for the provided + * class type. + * @param entityClass entity class + * @return list of all entity graphs defined for the entity + * @throws IllegalArgumentException if the class is not an entity + * @since Java Persistence 2.1 + */ + public List> getEntityGraphs(Class entityClass); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/EntityManagerFactory.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EntityManagerFactory.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EntityManagerFactory.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,223 @@ +/******************************************************************************* + * 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.util.Map; +import javax.persistence.metamodel.Metamodel; +import javax.persistence.criteria.CriteriaBuilder; + +/** + * Interface used to interact with the entity manager factory + * for the persistence unit. + * + *

When the application has finished using the entity manager + * factory, and/or at application shutdown, the application should + * close the entity manager factory. Once an + * EntityManagerFactory has been closed, all its entity managers + * are considered to be in the closed state. + * + * @since Java Persistence 1.0 + */ +public interface EntityManagerFactory { + + /** + * Create a new application-managed EntityManager. + * This method returns a new EntityManager instance each time + * it is invoked. + * The isOpen method will return true on the returned instance. + * @return entity manager instance + * @throws IllegalStateException if the entity manager factory + * has been closed + */ + public EntityManager createEntityManager(); + + /** + * Create a new application-managed EntityManager with the + * specified Map of properties. + * This method returns a new EntityManager instance each time + * it is invoked. + * The isOpen method will return true on the returned instance. + * @param map properties for entity manager + * @return entity manager instance + * @throws IllegalStateException if the entity manager factory + * has been closed + */ + public EntityManager createEntityManager(Map map); + + /** + * Create a new JTA application-managed EntityManager with the + * specified synchronization type. + * This method returns a new EntityManager instance each time + * it is invoked. + * The isOpen method will return true on the returned instance. + * @param synchronizationType how and when the entity manager should be + * synchronized with the current JTA transaction + * @return entity manager instance + * @throws IllegalStateException if the entity manager factory + * has been configured for resource-local entity managers or is closed + * + * @since Java Persistence 2.1 + */ + public EntityManager createEntityManager(SynchronizationType synchronizationType); + + /** + * Create a new JTA application-managed EntityManager with the + * specified synchronization type and map of properties. + * This method returns a new EntityManager instance each time + * it is invoked. + * The isOpen method will return true on the returned instance. + * @param synchronizationType how and when the entity manager should be + * synchronized with the current JTA transaction + * @param map properties for entity manager + * @return entity manager instance + * @throws IllegalStateException if the entity manager factory + * has been configured for resource-local entity managers or is closed + * + * @since Java Persistence 2.1 + */ + public EntityManager createEntityManager(SynchronizationType synchronizationType, Map map); + + /** + * Return an instance of CriteriaBuilder for the creation of + * CriteriaQuery objects. + * @return CriteriaBuilder instance + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public CriteriaBuilder getCriteriaBuilder(); + + /** + * Return an instance of Metamodel interface for access to the + * metamodel of the persistence unit. + * @return Metamodel instance + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public Metamodel getMetamodel(); + + /** + * Indicates whether the factory is open. Returns true + * until the factory has been closed. + * @return boolean indicating whether the factory is open + */ + public boolean isOpen(); + + /** + * Close the factory, releasing any resources that it holds. + * After a factory instance has been closed, all methods invoked + * on it will throw the IllegalStateException, except + * for isOpen, which will return false. Once an + * EntityManagerFactory has been closed, all its + * entity managers are considered to be in the closed state. + * @throws IllegalStateException if the entity manager factory + * has been closed + */ + public void close(); + + /** + * Get the properties and associated values that are in effect + * for the entity manager factory. Changing the contents of the + * map does not change the configuration in effect. + * @return properties + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public Map getProperties(); + + /** + * Access the cache that is associated with the entity manager + * factory (the "second level cache"). + * @return instance of the Cache interface or null if + * no cache is in use + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public Cache getCache(); + + /** + * Return interface providing access to utility methods + * for the persistence unit. + * @return PersistenceUnitUtil interface + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public PersistenceUnitUtil getPersistenceUnitUtil(); + + /** + * Define the query, typed query, or stored procedure query as + * a named query such that future query objects can be created + * from it using the createNamedQuery or + * createNamedStoredProcedureQuery method. + *

Any configuration of the query object (except for actual + * parameter binding) in effect when the named query is added + * is retained as part of the named query definition. + * This includes configuration information such as max results, + * hints, flush mode, lock mode, result set mapping information, + * and information about stored procedure parameters. + *

When the query is executed, information that can be set + * by means of the query APIs can be overridden. Information + * that is overridden does not affect the named query as + * registered with the entity manager factory, and thus does + * not affect subsequent query objects created from it by + * means of the createNamedQuery or + * createNamedStoredProcedureQuery method. + *

If a named query of the same name has been previously + * defined, either statically via metadata or via this method, + * that query definition is replaced. + * + * @param name name for the query + * @param query Query, TypedQuery, or StoredProcedureQuery object + * + * @since Java Persistence 2.1 + */ + public void addNamedQuery(String name, Query query); + + /** + * Return an object of the specified type to allow access to the + * provider-specific API. If the provider's EntityManagerFactory + * implementation does not support the specified class, the + * PersistenceException is thrown. + * @param cls the class of the object to be returned. This is + * normally either the underlying EntityManagerFactory + * implementation class or an interface that it implements. + * @return an instance of the specified class + * @throws PersistenceException if the provider does not + * support the call + * @since Java Persistence 2.1 + */ + public T unwrap(Class cls); + + /** + * Add a named copy of the EntityGraph to the + * EntityManagerFactory. If an entity graph with the same name + * already exists, it is replaced. + * @param graphName name for the entity graph + * @param entityGraph entity graph + * @since Java Persistence 2.1 + */ + public void addNamedEntityGraph(String graphName, EntityGraph entityGraph); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/EntityNotFoundException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EntityNotFoundException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EntityNotFoundException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,60 @@ +/******************************************************************************* + * 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; + +/** + * Thrown by the persistence provider when an entity reference obtained by + * {@link EntityManager#getReference EntityManager.getReference} + * is accessed but the entity does not exist. Thrown when + * {@link EntityManager#refresh EntityManager.refresh} is called and the + * object no longer exists in the database. + * Thrown when {@link EntityManager#lock EntityManager.lock} is used with + * pessimistic locking is used and the entity no longer exists in the database. + *

The current transaction, if one is active and the persistence context + * has been joined to it, will be marked for rollback. + * + * @see EntityManager#getReference(Class,Object) + * @see EntityManager#refresh(Object) + * @see EntityManager#refresh(Object, LockModeType) + * @see EntityManager#refresh(Object, java.util.Map) + * @see EntityManager#refresh(Object, LockModeType, java.util.Map) + * @see EntityManager#lock(Object, LockModeType) + * @see EntityManager#lock(Object, LockModeType, java.util.Map) + * + * @since Java Persistence 1.0 + */ +public class EntityNotFoundException extends PersistenceException { + + /** + * Constructs a new EntityNotFoundException exception with + * null as its detail message. + */ + public EntityNotFoundException() { + super(); + } + + /** + * Constructs a new EntityNotFoundException exception with the + * specified detail message. + * + * @param message + * the detail message. + */ + public EntityNotFoundException(String message) { + super(message); + } + +} Index: 3rdParty_sources/persistence-api/javax/persistence/EntityResult.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EntityResult.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EntityResult.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2014 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.RetentionPolicy.RUNTIME; + +/** + * Used in conjunction with the {@link SqlResultSetMapping} annotation to map the SELECT + * clause of a SQL query to an entity result. + * + *

If this annotation is used, the SQL statement should select + * all of the columns that are mapped to the entity object. + * This should include foreign key columns to related entities. + * The results obtained when insufficient data is available + * are undefined. + * + *

+ *   Example:
+ *
+ *   Query q = em.createNativeQuery(
+ *       "SELECT o.id, o.quantity, o.item, i.id, i.name, i.description "+
+ *           "FROM Order o, Item i " +
+ *           "WHERE (o.quantity > 25) AND (o.item = i.id)",
+ *       "OrderItemResults");
+ *   @SqlResultSetMapping(name="OrderItemResults",
+ *       entities={
+ *           @EntityResult(entityClass=com.acme.Order.class),
+ *           @EntityResult(entityClass=com.acme.Item.class)
+ *   })
+ * 
+ * + * @see SqlResultSetMapping + * + * @since Java Persistence 1.0 + */ +@Target({}) +@Retention(RUNTIME) +public @interface EntityResult { + + /** The class of the result. */ + Class entityClass(); + + /** + * Maps the columns specified in the SELECT list of the + * query to the properties or fields of the entity class. + */ + FieldResult[] fields() default {}; + + /** + * Specifies the column name (or alias) of the column in + * the SELECT list that is used to determine the type of + * the entity instance. + */ + String discriminatorColumn() default ""; +} Index: 3rdParty_sources/persistence-api/javax/persistence/EntityTransaction.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EntityTransaction.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EntityTransaction.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,76 @@ +/******************************************************************************* + * 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; + +/** + * Interface used to control transactions on resource-local entity + * managers. The {@link EntityManager#getTransaction + * EntityManager.getTransaction()} method returns the + * EntityTransaction interface. + + * + * @since Java Persistence 1.0 + */ +public interface EntityTransaction { + + /** + * Start a resource transaction. + * @throws IllegalStateException if isActive() is true + */ + public void begin(); + + /** + * Commit the current resource transaction, writing any + * unflushed changes to the database. + * @throws IllegalStateException if isActive() is false + * @throws RollbackException if the commit fails + */ + public void commit(); + + /** + * Roll back the current resource transaction. + * @throws IllegalStateException if isActive() is false + * @throws PersistenceException if an unexpected error + * condition is encountered + */ + public void rollback(); + + /** + * Mark the current resource transaction so that the only + * possible outcome of the transaction is for the transaction + * to be rolled back. + * @throws IllegalStateException if isActive() is false + */ + public void setRollbackOnly(); + + /** + * Determine whether the current resource transaction has been + * marked for rollback. + * @return boolean indicating whether the transaction has been + * marked for rollback + * @throws IllegalStateException if isActive() is false + */ + public boolean getRollbackOnly(); + + /** + * Indicate whether a resource transaction is in progress. + * @return boolean indicating whether transaction is + * in progress + * @throws PersistenceException if an unexpected error + * condition is encountered + */ + public boolean isActive(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/EnumType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/EnumType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/EnumType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,31 @@ +/******************************************************************************* + * 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 mapping for enumerated types. The constants of this + * enumerated type specify how a persistent property or + * field of an enumerated type should be persisted. + * + * @since Java Persistence 1.0 + */ +public enum EnumType { + /** Persist enumerated type property or field as an integer. */ + ORDINAL, + + /** Persist enumerated type property or field as a string. */ + STRING +} Index: 3rdParty_sources/persistence-api/javax/persistence/Enumerated.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Enumerated.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Enumerated.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2014 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; +import static javax.persistence.EnumType.ORDINAL; + +/** + * Specifies that a persistent property or field should be persisted + * as a enumerated type. The Enumerated annotation may + * be used in conjunction with the Basic annotation, or in + * conjunction with the ElementCollection annotation when the + * element collection value is of basic type. If the enumerated type + * is not specified or the Enumerated annotation is not + * used, the EnumType value is assumed to be ORDINAL. + * + *
+ *   Example:
+ *
+ *   public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT}
+ *
+ *   public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}
+ *
+ *   @Entity public class Employee {
+ *       public EmployeeStatus getStatus() {...}
+ *       ...
+ *       @Enumerated(STRING)
+ *       public SalaryRate getPayScale() {...}
+ *       ...
+ *   }
+ * 
+ * + * @see Basic + * @see ElementCollection + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Enumerated { + + /** (Optional) The type used in mapping an enum type. */ + EnumType value() default ORDINAL; +} Index: 3rdParty_sources/persistence-api/javax/persistence/ExcludeDefaultListeners.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ExcludeDefaultListeners.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ExcludeDefaultListeners.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,33 @@ +/******************************************************************************* + * 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 that the invocation of default listeners is + * to be excluded for the entity class (or mapped superclass) + * and its subclasses. + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface ExcludeDefaultListeners { +} Index: 3rdParty_sources/persistence-api/javax/persistence/ExcludeSuperclassListeners.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ExcludeSuperclassListeners.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ExcludeSuperclassListeners.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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 that the invocation of superclass listeners is + * to be excluded for the entity class (or mapped superclass) + * and its subclasses. + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) + +public @interface ExcludeSuperclassListeners { +} Index: 3rdParty_sources/persistence-api/javax/persistence/FetchType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/FetchType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/FetchType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,49 @@ +/******************************************************************************* + * 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 strategies for fetching data from the database. + * The EAGER strategy is a requirement on the persistence + * provider runtime that data must be eagerly fetched. The + * LAZY strategy is a hint to the persistence provider + * runtime that data should be fetched lazily when it is + * first accessed. The implementation is permitted to eagerly + * fetch data for which the LAZY strategy hint has been + * specified. + * + *
+ *   Example:
+ *   @Basic(fetch=LAZY)
+ *   protected String getName() { return name; }
+ * 
+ * + * @see Basic + * @see ElementCollection + * @see ManyToMany + * @see OneToMany + * @see ManyToOne + * @see OneToOne + * @since Java Persistence 1.0 + */ +public enum FetchType { + + /** Defines that data can be lazily fetched. */ + LAZY, + + /** Defines that data must be eagerly fetched. */ + EAGER +} Index: 3rdParty_sources/persistence-api/javax/persistence/FieldResult.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/FieldResult.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/FieldResult.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2014 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.RetentionPolicy.RUNTIME; + +/** + * Used in conjunction with the {@link EntityResult} annotation to map columns specified + * in the SELECT list of a SQL query to the properties or fields of an entity class. + * + *
+ *
+ * Example:
+ *   Query q = em.createNativeQuery(
+ *       "SELECT o.id AS order_id, " +
+ *           "o.quantity AS order_quantity, " +
+ *           "o.item AS order_item, " +
+ *         "FROM Order o, Item i " +
+ *         "WHERE (order_quantity > 25) AND (order_item = i.id)",
+ *       "OrderResults");
+ *
+ *   @SqlResultSetMapping(name="OrderResults",
+ *       entities={
+ *           @EntityResult(entityClass=com.acme.Order.class, fields={
+ *               @FieldResult(name="id", column="order_id"),
+ *               @FieldResult(name="quantity", column="order_quantity"),
+ *               @FieldResult(name="item", column="order_item")})
+ *       })
+ * 
+ * + * @see EntityResult + * @see SqlResultSetMapping + * @since Java Persistence 1.0 + */ +@Target({}) +@Retention(RUNTIME) + +public @interface FieldResult { + + /** Name of the persistent field or property of the class. */ + String name(); + + /** + * Name of the column in the SELECT clause - i.e., column + * aliases, if applicable. + */ + String column(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/FlushModeType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/FlushModeType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/FlushModeType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,52 @@ +/******************************************************************************* + * 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; + +/** + * Flush mode setting. + * + *

When queries are executed within a transaction, if + * FlushModeType.AUTO is set on the {@link + * javax.persistence.Query Query} or {@link javax.persistence.TypedQuery + * TypedQuery} object, or if the flush mode setting for the + * persistence context is AUTO (the default) and a flush + * mode setting has not been specified for the Query or + * TypedQuery object, the persistence provider is + * responsible for ensuring that all updates to the state of all + * entities in the persistence context which could potentially affect + * the result of the query are visible to the processing of the + * query. The persistence provider implementation may achieve this by + * flushing those entities to the database or by some other means. + *

If FlushModeType.COMMIT is set, the effect of + * updates made to entities in the persistence context upon queries is + * unspecified. + * + *

If there is no transaction active or the persistence context is not + * joined to the current transaction, the persistence provider must not flush + * to the database. + * + * @since Java Persistence 1.0 + */ +public enum FlushModeType { + + /** Flushing to occur at transaction commit. The provider may flush + * at other times, but is not required to. + */ + COMMIT, + + /** (Default) Flushing to occur at query execution. */ + AUTO +} Index: 3rdParty_sources/persistence-api/javax/persistence/ForeignKey.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ForeignKey.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ForeignKey.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2017 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 + * + ******************************************************************************/ +package javax.persistence; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import static javax.persistence.ConstraintMode.CONSTRAINT; + +/** + * Used to specify the handling of foreign key constraints when schema + * generation is in effect. If this annotation is not specified, the + * persistence provider's default foreign key strategy will be used. + *

+ * The ConstraintMode value is used to specify whether foreign + * key constraints should be generated. + *

+ * The syntax used in the foreignKeyDefinition element + * should follow the SQL syntax used by the target database for foreign + * key constraints. For example, this may be similar the following: + *

+ * FOREIGN KEY ( <COLUMN expression> {, <COLUMN expression>}... )
+ * REFERENCES <TABLE identifier> [
+ *     (<COLUMN expression> {, <COLUMN expression>}... ) ]
+ * [ ON UPDATE <referential action> ]
+ * [ ON DELETE <referential action> ]
+ * 
+ * + * When the ConstraintMode value is + * CONSTRAINT, but the foreignKeyDefinition + * element is not specified, the provider will generate foreign key + * constraints whose update and delete actions it determines most + * appropriate for the join column(s) to which the foreign key + * annotation is applied. + * + * @see JoinColumn + * @see JoinColumns + * @see MapKeyJoinColumn + * @see MapKeyJoinColumns + * @see PrimaryKeyJoinColumn + * @see JoinTable + * @see CollectionTable + * @see SecondaryTable + * @see AssociationOverride + * + * @since Java Persistence 2.1 + */ +@Target({}) +@Retention(RUNTIME) +public @interface ForeignKey { + + /** + * (Optional) The name of the foreign key constraint. If this + * is not specified, it defaults to a provider-generated name. + */ + String name() default ""; + + /** + * (Optional) Used to specify whether a foreign key constraint should be + * generated when schema generation is in effect. + *

+ * A value of CONSTRAINT will cause the persistence + * provider to generate a foreign key constraint. If the + * foreignKeyDefinition element is not specified, the + * provider will generate a constraint whose update + * and delete actions it determines most appropriate for the + * join column(s) to which the foreign key annotation is applied. + *

+ * A value of NO_CONSTRAINT will result in no + * constraint being generated. + *

+ * A value of PROVIDER_DEFAULT will result in the + * provider's default behavior (which may or may not result + * in the generation of a constraint for the given join column(s). + */ + ConstraintMode value() default CONSTRAINT; + + /** + * (Optional) The foreign key constraint definition. + */ + String foreignKeyDefinition() default ""; +} Index: 3rdParty_sources/persistence-api/javax/persistence/GeneratedValue.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/GeneratedValue.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/GeneratedValue.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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; +import static javax.persistence.GenerationType.AUTO; + +/** + * Provides for the specification of generation strategies for the + * values of primary keys. + * + *

The GeneratedValue 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 GeneratedValue annotation is only + * required to be supported for simple primary keys. Use of the + * GeneratedValue annotation is not supported for derived + * primary keys. + * + *

+ *
+ *     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;
+ * 
+ * + * @see Id + * @see TableGenerator + * @see SequenceGenerator + * + * @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. + */ + GenerationType strategy() default AUTO; + + /** + * (Optional) The name of the primary key generator + * to use as specified in the {@link SequenceGenerator} + * or {@link TableGenerator} annotation. + *

Defaults to the id generator supplied by persistence provider. + */ + String generator() default ""; +} Index: 3rdParty_sources/persistence-api/javax/persistence/GenerationType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/GenerationType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/GenerationType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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 + * AUTO 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 +} Index: 3rdParty_sources/persistence-api/javax/persistence/Id.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Id.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Id.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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 Id annotation is applied + * should be one of the following types: any Java primitive type; + * any primitive wrapper type; + * String; + * java.util.Date; + * java.sql.Date; + * java.math.BigDecimal; + * java.math.BigInteger. + * + *

The mapped column for the primary key of the entity is assumed + * to be the primary key of the primary table. If no Column annotation + * is specified, the primary key column name is assumed to be the name + * of the primary key property or field. + * + *

+ *   Example:
+ *
+ *   @Id
+ *   public Long getId() { return id; }
+ * 
+ * + * @see Column + * @see GeneratedValue + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface Id {} Index: 3rdParty_sources/persistence-api/javax/persistence/IdClass.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/IdClass.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/IdClass.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,53 @@ +/******************************************************************************* + * 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 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 + */ +@Target({TYPE}) +@Retention(RUNTIME) + +public @interface IdClass { + + /** Primary key class */ + Class value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/Index.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Index.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Index.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ +package javax.persistence; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Used in schema generation to specify creation of an index. + *

+ * Note that it is not necessary to specify an index for a primary key, + * as the primary key index will be created automatically. + * + *

+ * The syntax of the columnList element is a + * column_list, as follows: + * + *

+ *    column::= index_column [,index_column]*
+ *    index_column::= column_name [ASC | DESC]
+ * 
+ * + *

If ASC or DESC is not specified, + * ASC (ascending order) is assumed. + * + * @see Table + * @see SecondaryTable + * @see CollectionTable + * @see JoinTable + * @see TableGenerator + * + * @since Java Persistence 2.1 + * + */ +@Target({}) +@Retention(RUNTIME) +public @interface Index { + + /** + * (Optional) The name of the index; defaults to a provider-generated name. + */ + String name() default ""; + + /** + * (Required) The names of the columns to be included in the index, + * in order. + */ + String columnList(); + + /** + * (Optional) Whether the index is unique. + */ + boolean unique() default false; + +} Index: 3rdParty_sources/persistence-api/javax/persistence/Inheritance.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Inheritance.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Inheritance.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2014 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; +import static javax.persistence.InheritanceType.SINGLE_TABLE; + +/** + * Specifies the inheritance strategy to be used for an entity class + * hierarchy. It is specified on the entity class that is the root of + * the entity class hierarchy. If the Inheritance annotation is not + * specified or if no inheritance type is specified for an entity + * class hierarchy, the SINGLE_TABLE mapping strategy is used. + * + *

+ *
+ *   Example:
+ *
+ *   @Entity
+ *   @Inheritance(strategy=JOINED)
+ *   public class Customer { ... }
+ *
+ *   @Entity
+ *   public class ValuedCustomer extends Customer { ... }
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) + +public @interface Inheritance { + + /** The strategy to be used for the entity inheritance hierarchy. */ + InheritanceType strategy() default SINGLE_TABLE; +} Index: 3rdParty_sources/persistence-api/javax/persistence/InheritanceType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/InheritanceType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/InheritanceType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,38 @@ +/******************************************************************************* + * 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 inheritance strategy options. + * + * @since Java Persistence 1.0 + */ +public enum InheritanceType { + + /** A single table per class hierarchy. */ + SINGLE_TABLE, + + /** A table per concrete entity class. */ + TABLE_PER_CLASS, + + /** + * A strategy in which fields that are specific to a + * subclass are mapped to a separate table than the fields + * that are common to the parent class, and a join is + * performed to instantiate the subclass. + */ + JOINED +} Index: 3rdParty_sources/persistence-api/javax/persistence/JoinColumn.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/JoinColumn.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/JoinColumn.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,185 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +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; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Specifies a column for joining an entity association or element + * collection. If the JoinColumn annotation itself is + * defaulted, a single join column is assumed and the default values + * apply. + * + *
+ *   Example:
+ *
+ *   @ManyToOne
+ *   @JoinColumn(name="ADDR_ID")
+ *   public Address getAddress() { return address; }
+ *
+ *
+ *   Example: unidirectional one-to-many association using a foreign key mapping
+ * 
+ *   // In Customer class
+ *   @OneToMany
+ *   @JoinColumn(name="CUST_ID") // join column is in table for Order
+ *   public Set<Order> getOrders() {return orders;}
+ * 
+ * + * @see ManyToOne + * @see OneToMany + * @see OneToOne + * @see JoinTable + * @see CollectionTable + * @see ForeignKey + * + * @since Java Persistence 1.0 + */ +@Repeatable(JoinColumns.class) +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface JoinColumn { + + /** + * (Optional) The name of the foreign key column. + * The table in which it is found depends upon the + * context. + *
    + *
  • If the join is for a OneToOne or ManyToOne + * mapping using a foreign key mapping strategy, + * the foreign key column is in the table of the + * source entity or embeddable. + *
  • If the join is for a unidirectional OneToMany mapping + * using a foreign key mapping strategy, the foreign key is in the + * table of the target entity. + *
  • If the join is for a ManyToMany mapping or for a OneToOne + * or bidirectional ManyToOne/OneToMany mapping using a join + * table, the foreign key is in a join table. + *
  • If the join is for an element collection, the foreign + * key is in a collection table. + *
+ * + *

Default (only applies if a single join column is used): + * The concatenation of the following: the name of the + * referencing relationship property or field of the referencing + * entity or embeddable class; "_"; the name of the referenced + * primary key column. + * If there is no such referencing relationship property or + * field in the entity, or if the join is for an element collection, + * the join column name is formed as the + * concatenation of the following: the name of the entity; "_"; + * the name of the referenced primary key column. + */ + String name() default ""; + + /** + * (Optional) The name of the column referenced by this foreign + * key column. + *

    + *
  • When used with entity relationship mappings other + * than the cases described here, the referenced column is in the + * table of the target entity. + *
  • When used with a unidirectional OneToMany foreign key + * mapping, the referenced column is in the table of the source + * entity. + *
  • When used inside a JoinTable annotation, + * the referenced key column is in the entity table of the owning + * entity, or inverse entity if the join is part of the inverse + * join definition. + *
  • When used in a CollectionTable mapping, the + * referenced column is in the table of the entity containing the + * collection. + *
+ * + *

Default (only applies if single join column is being + * used): The same name as the primary key column of the + * referenced table. + */ + String referencedColumnName() default ""; + + /** + * (Optional) Whether the property is a unique key. This is a + * shortcut for the UniqueConstraint annotation at + * the table level and is useful for when the unique key + * constraint is only a single field. It is not necessary to + * explicitly specify this for a join column that corresponds to a + * primary key that is part of a foreign key. + */ + boolean unique() default false; + + /** (Optional) Whether the foreign key column is nullable. */ + boolean nullable() default true; + + /** + * (Optional) Whether the column is included in + * SQL INSERT statements generated by the persistence + * provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in + * SQL UPDATE statements generated by the persistence + * provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when + * generating the DDL for the column. + *

Defaults to the generated SQL for the column. + */ + String columnDefinition() default ""; + + /** + * (Optional) The name of the table that contains + * the column. If a table is not specified, the column + * is assumed to be in the primary table of the + * applicable entity. + * + *

Default: + *

    + *
  • If the join is for a OneToOne or ManyToOne mapping + * using a foreign key mapping strategy, the name of the table of + * the source entity or embeddable. + *
  • If the join is for a unidirectional OneToMany mapping + * using a foreign key mapping strategy, the name of the table of + * the target entity. + *
  • If the join is for a ManyToMany mapping or + * for a OneToOne or bidirectional ManyToOne/OneToMany mapping + * using a join table, the name of the join table. + *
  • If the join is for an element collection, the name of the collection table. + *
+ */ + String table() default ""; + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint when table generation is in effect. If + * this element is not specified, the persistence provider's + * default foreign key strategy will apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); +} Index: 3rdParty_sources/persistence-api/javax/persistence/JoinColumns.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/JoinColumns.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/JoinColumns.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,70 @@ +/******************************************************************************* + * 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; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Specifies the mapping for 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; }
+ * 
+ * + * @see JoinColumn + * @see ForeignKey + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface JoinColumns { + + /** + * The join columns that map the relationship. + */ + JoinColumn[] value(); + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint when table generation is in effect. + * If both this element and the foreignKey element + * of any of the JoinColumn elements are specified, + * the behavior is undefined. If no foreign key annotation element + * is specified in either location, the persistence provider's + * default foreign key strategy will apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); +} Index: 3rdParty_sources/persistence-api/javax/persistence/JoinTable.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/JoinTable.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/JoinTable.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,155 @@ +/******************************************************************************* + * 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; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Specifies the mapping of associations. It is applied to the + * owning side of an association. + * + *

A join table is typically used in the mapping of many-to-many + * and unidirectional one-to-many associations. It may also be used to + * map bidirectional many-to-one/one-to-many associations, + * unidirectional many-to-one relationships, and one-to-one + * associations (both bidirectional and unidirectional). + * + *

When a join table is used in mapping a relationship with an + *embeddable class on the owning side of the relationship, the + *containing entity rather than the embeddable class is considered the + *owner of the relationship. + * + *

If the JoinTable annotation is missing, the + * default values of the annotation elements apply. + * The name of the join table is assumed to be the table names of the + * associated primary tables concatenated together (owning side + * first) using an underscore. + * + *

+ *
+ *    Example:
+ *
+ *    @JoinTable(
+ *        name="CUST_PHONE",
+ *        joinColumns=
+ *            @JoinColumn(name="CUST_ID", referencedColumnName="ID"),
+ *        inverseJoinColumns=
+ *            @JoinColumn(name="PHONE_ID", referencedColumnName="ID")
+ *    )
+ * 
+ * + * @see JoinColumn + * @see JoinColumns + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface JoinTable { + + /** + * (Optional) The name of the join table. + * + *

Defaults to the concatenated names of + * the two associated primary entity tables, + * separated by an underscore. + */ + String name() default ""; + + /** (Optional) The catalog of the table. + *

Defaults to the default catalog. + */ + String catalog() default ""; + + /** (Optional) The schema of the table. + *

Defaults to the default schema for user. + */ + String schema() default ""; + + /** + * (Optional) The foreign key columns + * of the join table which reference the + * primary table of the entity owning the + * association. (I.e. the owning side of + * the association). + * + *

Uses the same defaults as for {@link JoinColumn}. + */ + JoinColumn[] joinColumns() default {}; + + /** + * (Optional) The foreign key columns + * of the join table which reference the + * primary table of the entity that does + * not own the association. (I.e. the + * inverse side of the association). + * + *

Uses the same defaults as for {@link JoinColumn}. + */ + JoinColumn[] inverseJoinColumns() default {}; + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint for the columns corresponding to the + * joinColumns element when table generation is in + * effect. If both this element and the foreignKey + * element of any of the joinColumns elements are + * specified, the behavior is undefined. If no foreign key + * annotation element is specified in either location, the + * persistence provider's default foreign key strategy will + * apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint for the columns corresponding to the + * inverseJoinColumns element when table generation + * is in effect. If both this element and the + * foreignKey element of any of the + * inverseJoinColumns elements are specified, the + * behavior is undefined. If no foreign key annotation element + * is specified in either location, the persistence provider's + * default foreign key strategy will apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey inverseForeignKey() default @ForeignKey(PROVIDER_DEFAULT); + + /** + * (Optional) Unique constraints that are + * to be placed on the table. These are + * only used if table generation is in effect. + *

Defaults to no additional constraints. + */ + UniqueConstraint[] uniqueConstraints() default {}; + + /** + * (Optional) Indexes for the table. These are only used if + * table generation is in effect. + * + * @since Java Persistence 2.1 + */ + Index[] indexes() default {}; +} Index: 3rdParty_sources/persistence-api/javax/persistence/Lob.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Lob.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Lob.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,62 @@ +/******************************************************************************* + * 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 that a persistent property or field should be persisted + * as a large object to a database-supported large object type. + * + *

Portable applications should use the Lob annotation + * when mapping to a database Lob type. The Lob + * annotation may be used in conjunction with the {@link Basic} + * annotation or the {@link ElementCollection} annotation when the + * element collection value is of basic type. A Lob may + * be either a binary or character type. + * + *

The Lob type is inferred from the type of the + * persistent field or property, and except for string and + * character-based types defaults to Blob. + *

+ *
+ *   Example 1:
+ *
+ *   @Lob @Basic(fetch=LAZY)
+ *   @Column(name="REPORT")
+ *   protected String report;
+ *
+ *   Example 2:
+ *
+ *   @Lob @Basic(fetch=LAZY)
+ *   @Column(name="EMP_PIC", columnDefinition="BLOB NOT NULL")
+ *   protected byte[] pic;
+ *
+ * 
+ * + * @see Basic + * @see ElementCollection + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Lob { +} Index: 3rdParty_sources/persistence-api/javax/persistence/LockModeType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/LockModeType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/LockModeType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,188 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2014 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; + +/** + * Lock modes can be specified by means of passing a LockModeType + * argument to one of the {@link javax.persistence.EntityManager} methods that take locks + * (lock, find, or refresh) or + * to the {@link Query#setLockMode Query.setLockMode()} or + * {@link TypedQuery#setLockMode TypedQuery.setLockMode()} method. + * + *

Lock modes can be used to specify either optimistic or pessimistic locks. + * + *

Optimistic locks are specified using {@link + * LockModeType#OPTIMISTIC LockModeType.OPTIMISTIC} and {@link + * LockModeType#OPTIMISTIC_FORCE_INCREMENT + * LockModeType.OPTIMISTIC_FORCE_INCREMENT}. The lock mode type + * values {@link LockModeType#READ LockModeType.READ} and + * {@link LockModeType#WRITE LockModeType.WRITE} are + * synonyms of OPTIMISTIC and + * OPTIMISTIC_FORCE_INCREMENT respectively. The latter + * are to be preferred for new applications. + * + *

The semantics of requesting locks of type + * LockModeType.OPTIMISTIC and + * LockModeType.OPTIMISTIC_FORCE_INCREMENT are the + * following. + * + *

If transaction T1 calls for a lock of type + * LockModeType.OPTIMISTIC on a versioned object, + * the entity manager must ensure that neither of the following + * phenomena can occur: + *

    + *
  • P1 (Dirty read): Transaction T1 modifies a row. + * Another transaction T2 then reads that row and obtains + * the modified value, before T1 has committed or rolled back. + * Transaction T2 eventually commits successfully; it does not + * matter whether T1 commits or rolls back and whether it does + * so before or after T2 commits. + *
  • + *
  • P2 (Non-repeatable read): Transaction T1 reads a row. + * Another transaction T2 then modifies or deletes that row, + * before T1 has committed. Both transactions eventually commit + * successfully. + *
  • + *
+ * + *

Lock modes must always prevent the phenomena P1 and P2. + * + *

In addition, calling a lock of type + * LockModeType.OPTIMISTIC_FORCE_INCREMENT on a versioned object, + * will also force an update (increment) to the entity's version + * column. + * + *

The persistence implementation is not required to support + * the use of optimistic lock modes on non-versioned objects. When it + * cannot support a such lock call, it must throw the {@link + * PersistenceException}. + * + *

The lock modes {@link LockModeType#PESSIMISTIC_READ + * LockModeType.PESSIMISTIC_READ}, {@link + * LockModeType#PESSIMISTIC_WRITE LockModeType.PESSIMISTIC_WRITE}, and + * {@link LockModeType#PESSIMISTIC_FORCE_INCREMENT + * LockModeType.PESSIMISTIC_FORCE_INCREMENT} are used to immediately + * obtain long-term database locks. + * + *

The semantics of requesting locks of type + * LockModeType.PESSIMISTIC_READ, LockModeType.PESSIMISTIC_WRITE, and + * LockModeType.PESSIMISTIC_FORCE_INCREMENT are the following. + * + *

If transaction T1 calls for a lock of type + * LockModeType.PESSIMISTIC_READ or + * LockModeType.PESSIMISTIC_WRITE on an object, the entity + * manager must ensure that neither of the following phenomena can + * occur: + *

    + *
  • P1 (Dirty read): Transaction T1 modifies a + * row. Another transaction T2 then reads that row and obtains the + * modified value, before T1 has committed or rolled back. + * + *
  • P2 (Non-repeatable read): Transaction T1 reads a row. Another + * transaction T2 then modifies or deletes that row, before T1 has + * committed or rolled back. + *
+ * + *

A lock with LockModeType.PESSIMISTIC_WRITE can be obtained on + * an entity instance to force serialization among transactions + * attempting to update the entity data. A lock with + * LockModeType.PESSIMISTIC_READ can be used to query data using + * repeatable-read semantics without the need to reread the data at + * the end of the transaction to obtain a lock, and without blocking + * other transactions reading the data. A lock with + * LockModeType.PESSIMISTIC_WRITE can be used when querying data and + * there is a high likelihood of deadlock or update failure among + * concurrent updating transactions. + * + *

The persistence implementation must support use of locks of type + * LockModeType.PESSIMISTIC_READ + * LockModeType.PESSIMISTIC_WRITE on a non-versioned entity as well as + * on a versioned entity. + * + *

When the lock cannot be obtained, and the database locking + * failure results in transaction-level rollback, the provider must + * throw the {@link PessimisticLockException} and ensure that the JTA + * transaction or EntityTransaction has been marked for rollback. + * + *

When the lock cannot be obtained, and the database locking + * failure results in only statement-level rollback, the provider must + * throw the {@link LockTimeoutException} (and must not mark the transaction + * for rollback). + * + * @since Java Persistence 1.0 + * + */ +public enum LockModeType +{ + /** + * Synonymous with OPTIMISTIC. + * OPTIMISTIC is to be preferred for new + * applications. + * + */ + READ, + + /** + * Synonymous with OPTIMISTIC_FORCE_INCREMENT. + * OPTIMISTIC_FORCE_IMCREMENT is to be preferred for new + * applications. + * + */ + WRITE, + + /** + * Optimistic lock. + * + * @since Java Persistence 2.0 + */ + OPTIMISTIC, + + /** + * Optimistic lock, with version update. + * + * @since Java Persistence 2.0 + */ + OPTIMISTIC_FORCE_INCREMENT, + + /** + * + * Pessimistic read lock. + * + * @since Java Persistence 2.0 + */ + PESSIMISTIC_READ, + + /** + * Pessimistic write lock. + * + * @since Java Persistence 2.0 + */ + PESSIMISTIC_WRITE, + + /** + * Pessimistic write lock, with version update. + * + * @since Java Persistence 2.0 + */ + PESSIMISTIC_FORCE_INCREMENT, + + /** + * No lock. + * + * @since Java Persistence 2.0 + */ + NONE +} Index: 3rdParty_sources/persistence-api/javax/persistence/LockTimeoutException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/LockTimeoutException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/LockTimeoutException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,97 @@ +/******************************************************************************* + * 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; + +/** + * Thrown by the persistence provider when an pessimistic locking + * conflict occurs that does not result in transaction rollback. This + * exception may be thrown as part of an API call, at, flush or at + * commit time. The current transaction, if one is active, will be not + * be marked for rollback. + * + * @since Java Persistence 2.0 + */ +public class LockTimeoutException extends PersistenceException { + /** The object that caused the exception */ + Object entity; + + /** + * Constructs a new LockTimeoutException exception + * with null as its detail message. + */ + public LockTimeoutException() { + super(); + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified detail message. + * @param message the detail message. + */ + public LockTimeoutException(String message) { + super(message); + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified detail message and cause. + * @param message the detail message. + * @param cause the cause. + */ + public LockTimeoutException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified cause. + * @param cause the cause. + */ + public LockTimeoutException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified object. + * @param entity the entity. + */ + public LockTimeoutException(Object entity) { + this.entity = entity; + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified detail message, cause, and entity. + * @param message the detail message. + * @param cause the cause. + * @param entity the entity. + */ + public LockTimeoutException(String message, Throwable cause, Object entity) { + super(message, cause); + this.entity = entity; + } + + /** + * Returns the object that caused this exception. + * @return the entity + */ + public Object getObject() { + return this.entity; + } +} + + Index: 3rdParty_sources/persistence-api/javax/persistence/ManyToMany.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ManyToMany.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ManyToMany.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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 javax.persistence.CascadeType; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static javax.persistence.FetchType.LAZY; + +/** + * Specifies a many-valued association with many-to-many multiplicity. + * + *

Every many-to-many association has two sides, the owning side + * and the non-owning, or inverse, side. The join table is specified + * on the owning side. If the association is bidirectional, either + * side may be designated as the owning side. If the relationship is + * bidirectional, the non-owning side must use the mappedBy element of + * the ManyToMany annotation to specify the relationship field or + * property of the owning side. + * + *

The join table for the relationship, if not defaulted, is + * specified on the owning side. + * + *

The ManyToMany annotation may be used within an + * embeddable class contained within an entity class to specify a + * relationship to a collection of entities. If the relationship is + * bidirectional and the entity containing the embeddable class is the + * owner of the relationship, the non-owning side must use the + * mappedBy element of the ManyToMany + * annotation to specify the relationship field or property of the + * embeddable class. The dot (".") notation syntax must be used in the + * mappedBy element to indicate the relationship + * attribute within the embedded attribute. The value of each + * identifier used with the dot notation is the name of the respective + * embedded field or property. + * + *

+ *
+ *    Example 1:
+ *
+ *    // In Customer class:
+ *
+ *    @ManyToMany
+ *    @JoinTable(name="CUST_PHONES")
+ *    public Set<PhoneNumber> getPhones() { return phones; }
+ *
+ *    // In PhoneNumber class:
+ *
+ *    @ManyToMany(mappedBy="phones")
+ *    public Set<Customer> getCustomers() { return customers; }
+ *
+ *    Example 2:
+ *
+ *    // In Customer class:
+ *
+ *    @ManyToMany(targetEntity=com.acme.PhoneNumber.class)
+ *    public Set getPhones() { return phones; }
+ *
+ *    // In PhoneNumber class:
+ *
+ *    @ManyToMany(targetEntity=com.acme.Customer.class, mappedBy="phones")
+ *    public Set getCustomers() { return customers; }
+ *
+ *    Example 3:
+ *
+ *    // In Customer class:
+ *
+ *    @ManyToMany
+ *    @JoinTable(name="CUST_PHONE",
+ *        joinColumns=
+ *            @JoinColumn(name="CUST_ID", referencedColumnName="ID"),
+ *        inverseJoinColumns=
+ *            @JoinColumn(name="PHONE_ID", referencedColumnName="ID")
+ *        )
+ *    public Set<PhoneNumber> getPhones() { return phones; }
+ *
+ *    // In PhoneNumberClass:
+ *
+ *    @ManyToMany(mappedBy="phones")
+ *    public Set<Customer> getCustomers() { return customers; }
+ * 
+ * + * @see JoinTable + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface ManyToMany { + + /** + * (Optional) The entity class that is the target of the + * association. Optional only if the collection-valued + * relationship property is defined using Java generics. Must be + * specified otherwise. + * + *

Defaults to the parameterized type of + * the collection when defined using generics. + */ + Class targetEntity() default void.class; + + /** + * (Optional) The operations that must be cascaded to the target + * of the association. + * + *

When the target collection is a {@link java.util.Map + * java.util.Map}, the cascade element applies to the + * map value. + * + *

Defaults to no operations being cascaded. + */ + CascadeType[] cascade() default {}; + + /** (Optional) Whether the association should be lazily loaded or + * must be eagerly fetched. The EAGER strategy is a requirement on + * the persistence provider runtime that the associated entities + * must be eagerly fetched. The LAZY strategy is a hint to the + * persistence provider runtime. + */ + FetchType fetch() default LAZY; + + /** + * The field that owns the relationship. Required unless + * the relationship is unidirectional. + */ + String mappedBy() default ""; +} Index: 3rdParty_sources/persistence-api/javax/persistence/ManyToOne.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ManyToOne.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ManyToOne.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,118 @@ +/******************************************************************************* + * 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 javax.persistence.CascadeType; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static javax.persistence.FetchType.EAGER; + +/** + * Specifies a single-valued association to another entity class that + * has many-to-one multiplicity. It is not normally necessary to + * specify the target entity explicitly since it can usually be + * inferred from the type of the object being referenced. If the + * relationship is bidirectional, the non-owning + * OneToMany entity side must used the + * mappedBy element to specify the relationship field or + * property of the entity that is the owner of the relationship. + * + *

The ManyToOne annotation may be used within an + * embeddable class to specify a relationship from the embeddable + * class to an entity class. If the relationship is bidirectional, the + * non-owning OneToMany entity side must use the mappedBy + * element of the OneToMany annotation to specify the + * relationship field or property of the embeddable field or property + * on the owning side of the relationship. The dot (".") notation + * syntax must be used in the mappedBy element to indicate the + * relationship attribute within the embedded attribute. The value of + * each identifier used with the dot notation is the name of the + * respective embedded field or property. + *

+ *
+ *     Example 1:
+ *
+ *     @ManyToOne(optional=false) 
+ *     @JoinColumn(name="CUST_ID", nullable=false, updatable=false)
+ *     public Customer getCustomer() { return customer; }
+ *
+ *
+ *     Example 2:
+ * 
+ *     @Entity
+ *        public class Employee {
+ *        @Id int id;
+ *        @Embedded JobInfo jobInfo;
+ *        ...
+ *     }
+ *
+ *     @Embeddable
+ *        public class JobInfo {
+ *        String jobDescription; 
+ *        @ManyToOne ProgramManager pm; // Bidirectional
+ *     }
+ *
+ *     @Entity
+ *        public class ProgramManager {
+ *        @Id int id;
+ *        @OneToMany(mappedBy="jobInfo.pm")
+ *        Collection<Employee> manages;
+ *     }
+ *
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface ManyToOne { + + /** + * (Optional) The entity class that is the target of + * the association. + * + *

Defaults to the type of the field or property + * that stores the association. + */ + Class targetEntity() default void.class; + + /** + * (Optional) The operations that must be cascaded to + * the target of the association. + * + *

By default no operations are cascaded. + */ + CascadeType[] cascade() default {}; + + /** + * (Optional) Whether the association should be lazily + * loaded or must be eagerly fetched. The EAGER + * strategy is a requirement on the persistence provider runtime that + * the associated entity must be eagerly fetched. The LAZY + * strategy is a hint to the persistence provider runtime. + */ + FetchType fetch() default EAGER; + + /** + * (Optional) Whether the association is optional. If set + * to false then a non-null relationship must always exist. + */ + boolean optional() default true; +} Index: 3rdParty_sources/persistence-api/javax/persistence/MapKey.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/MapKey.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/MapKey.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,99 @@ +/******************************************************************************* + * 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 map key for associations of type + * {@link java.util.Map java.util.Map} when the map key is itself the primary + * key or a persistent field or property of the entity that is + * the value of the map. + * + *

If a persistent field or property other than the primary + * key is used as a map key then it is expected to have a + * uniqueness constraint associated with it. + * + *

The {@link MapKeyClass} annotation is not used when + * MapKey is specified and vice versa. + * + *

+ *
+ *    Example 1:
+ *
+ *    @Entity
+ *    public class Department {
+ *        ...
+ *        @OneToMany(mappedBy="department")
+ *        @MapKey  // map key is primary key
+ *        public Map<Integer, Employee> getEmployees() {... }
+ *        ...
+ *    }
+ *
+ *    @Entity
+ *    public class Employee {
+ *        ...
+ *        @Id Integer getEmpId() { ... }
+ *        @ManyToOne
+ *        @JoinColumn(name="dept_id")
+ *        public Department getDepartment() { ... }
+ *        ...
+ *    }
+ *
+ *    Example 2:
+ *
+ *    @Entity
+ *        public class Department {
+ *        ...
+ *        @OneToMany(mappedBy="department")
+ *        @MapKey(name="name")
+ *        public Map<String, Employee> getEmployees() {... }
+ *        ...
+ *    }
+ *
+ *    @Entity
+ *        public class Employee {
+ *        @Id public Integer getEmpId() { ... }
+ *        ...
+ *        @ManyToOne
+ *        @JoinColumn(name="dept_id")
+ *        public Department getDepartment() { ... }
+ *        ...
+ *    }
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface MapKey { + + /** + * (Optional) The name of the persistent field or property of the + * associated entity that is used as the map key. + *

Default: If the + * name element is not specified, the primary key of the + * associated entity is used as the map key. If the + * primary key is a composite primary key and is mapped + * as IdClass, an instance of the primary key + * class is used as the key. + */ + String name() default ""; +} Index: 3rdParty_sources/persistence-api/javax/persistence/MapKeyClass.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/MapKeyClass.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/MapKeyClass.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,99 @@ +/******************************************************************************* + * 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 type of the map key for associations of type + * java.util.Map. The map key can be a basic type, an + * embeddable class, or an entity. If the map is specified using Java + * generics, the MapKeyClass annotation and associated + * type need not be specified; otherwise they must be specified. + * + *

The MapKeyClass annotation is used in conjunction + * with ElementCollection or one of the collection-valued + * relationship annotations (OneToMany or ManyToMany). + * The MapKey annotation is not used when + * MapKeyClass is specified and vice versa. + * + *

+ *
+ *    Example 1:
+ *
+ *    @Entity
+ *    public class Item {
+ *       @Id int id;
+ *       ...
+ *       @ElementCollection(targetClass=String.class)
+ *       @MapKeyClass(String.class)
+ *       Map images;  // map from image name to image filename
+ *       ...
+ *    }
+ *
+ *    Example 2:
+ *
+ *    // MapKeyClass and target type of relationship can be defaulted
+ *
+ *    @Entity
+ *    public class Item {
+ *       @Id int id;
+ *       ...
+ *       @ElementCollection
+ *       Map<String, String> images; 
+ *        ...
+ *     }
+ *
+ *     Example 3:
+ *
+ *     @Entity
+ *     public class Company {
+ *        @Id int id;
+ *        ...
+ *        @OneToMany(targetEntity=com.example.VicePresident.class)
+ *        @MapKeyClass(com.example.Division.class)
+ *        Map organization;
+ *     }
+ *
+ *     Example 4:
+ *
+ *     // MapKeyClass and target type of relationship are defaulted
+ *
+ *     @Entity
+ *     public class Company {
+ *        @Id int id;
+ *        ...
+ *        @OneToMany
+ *        Map<Division, VicePresident> organization;
+ *     }
+ *
+ * 
+ * @see ElementCollection + * @see OneToMany + * @see ManyToMany + * @since Java Persistence 2.0 + */ + +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapKeyClass { + /**(Required) The type of the map key.*/ + Class value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/MapKeyColumn.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/MapKeyColumn.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/MapKeyColumn.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,132 @@ +/******************************************************************************* + * 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 mapping for the key column of a map whose + * map key is a basic type. If the name element is not specified, it + * defaults to the concatenation of the following: the name of the + * referencing relationship field or property; "_"; "KEY". + * + *
+ *    Example:
+ *
+ *    @Entity
+ *    public class Item {
+ *       @Id int id;
+ *       ...
+ *       @ElementCollection
+ *       @MapKeyColumn(name="IMAGE_NAME")
+ *       @Column(name="IMAGE_FILENAME")
+ *       @CollectionTable(name="IMAGE_MAPPING")
+ *       Map<String, String> images;  // map from image name to filename
+ *       ...
+ *    } 
+ * 
+ * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapKeyColumn { + + /** + * (Optional) The name of the map key column. The table in which it is found + * depends upon the context. If the map key is for an element collection, + * the map key column is in the collection table for the map value. If the + * map key is for a ManyToMany entity relationship or for a OneToMany entity + * relationship using a join table, the map key column is in a join table. + * If the map key is for a OneToMany entity relationship using a foreign key + * mapping strategy, the map key column is in the table of the entity that + * is the value of the map. + *

Defaults to the concatenation of the following: the name of + * the referencing relationship field or property; "_"; "KEY". + */ + String name() default ""; + + /** + * (Optional) Whether the column is a unique key. This is a + * shortcut for the UniqueConstraint 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. + */ + boolean unique() default false; + + /** (Optional) Whether the database column is nullable. */ + boolean nullable() default false; + + /** + * (Optional) Whether the column is included in SQL INSERT statements + * generated by the persistence provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in SQL UPDATE statements + * generated by the persistence provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when generating the DDL for the + * column. + *

Defaults to the generated SQL to create a + * column of the inferred type. + * + */ + String columnDefinition() default ""; + + /** (Optional) The name of the table that contains the column. + * + *

Defaults: If the map key is for an element collection, + * the name of the collection table for the map value. If the + * map key is for a OneToMany or ManyToMany entity + * relationship using a join table, the name of the join table + * for the map. If the map key is for a OneToMany entity + * relationship using a foreign key mapping strategy, the name + * of the primary table of the entity that is the value of the + * map. + */ + String table() default ""; + + /** + * (Optional) The column length. (Applies only if a string-valued column is + * used.) + */ + int length() default 255; + + /** + * (Optional) The precision for a decimal (exact numeric) column. (Applies + * only if a decimal column is used.) + * + *

Default: 0. (The value must be set by the developer.) + */ + int precision() default 0; // decimal precision + + /** + * (Optional) The scale for a decimal (exact numeric) column. (Applies only + * if a decimal column is used.) + */ + int scale() default 0; // decimal scale +} Index: 3rdParty_sources/persistence-api/javax/persistence/MapKeyEnumerated.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/MapKeyEnumerated.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/MapKeyEnumerated.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,65 @@ +/******************************************************************************* + * 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; +import static javax.persistence.EnumType.ORDINAL; + +/** + * Specifies the enum type for a map key whose basic type is an enumerated type. + * + * The MapKeyEnumerated annotation can be applied to an + * element collection or relationship of type java.util.Map, in + * conjunction with the ElementCollection, OneToMany, or + * ManyToMany annotation. + * If the enumerated type is not specified or the MapKeyEnumerated + * annotation is not used, the enumerated type is assumed to be + * ORDINAL. + * + *

+ *   Example:
+ *
+ *   public enum ProjectStatus {COMPLETE, DELAYED, CANCELLED, IN_PROGRESS}
+ *
+ *   public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}
+ *
+ *   @Entity public class Employee {
+ *       @ManyToMany
+ *       public Projects<ProjectStatus, Project> getProjects() {...}
+ *       
+ *       @OneToMany
+ *       @MapKeyEnumerated(STRING)
+ *       public Map<SalaryRate, Employee> getEmployees() {...}
+ *       ...
+ *   }
+ * 
+ * + * @see ElementCollection + * @see OneToMany + * @see ManyToMany + * + * @since Java Persistence 2.0 + */ +@Target({METHOD, FIELD}) @Retention(RUNTIME) +public @interface MapKeyEnumerated { + + /** (Optional) The type used in mapping a map key enum type. */ + EnumType value() default ORDINAL; +} Index: 3rdParty_sources/persistence-api/javax/persistence/MapKeyJoinColumn.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/MapKeyJoinColumn.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/MapKeyJoinColumn.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,197 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +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; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Specifies a mapping to an entity that is a map key. The map key + * join column is in the collection table, join table, or table of the + * target entity that is used to represent the map. If no + * MapKeyJoinColumn annotation is specified, a single + * join column is assumed and the default values apply. + * + *
+ *
+ *    Example 1:
+ *
+ *    @Entity
+ *    public class Company {
+ *       @Id int id;
+ *       ...
+ *       @OneToMany   // unidirectional
+ *       @JoinTable(name="COMPANY_ORGANIZATION",
+ *                  joinColumns=@JoinColumn(name="COMPANY"),
+ *                  inverseJoinColumns=@JoinColumn(name="VICEPRESIDENT"))
+ *       @MapKeyJoinColumn(name="DIVISION")
+ *       Map<Division, VicePresident> organization;
+ *    }
+ *
+ *    Example 2:
+ *
+ *    @Entity
+ *    public class VideoStore {
+ *       @Id int id;
+ *       String name;
+ *       Address location;
+ *       ...
+ *       @ElementCollection
+ *       @CollectionTable(name="INVENTORY",
+ *                        joinColumns=@JoinColumn(name="STORE"))
+ *       @Column(name="COPIES_IN_STOCK")
+ *       @MapKeyJoinColumn(name="MOVIE", referencedColumnName="ID")
+ *       Map<Movie, Integer> videoInventory;
+ *       ...
+ *     }
+ *
+ *     @Entity
+ *     public class Movie {
+ *        @Id long id;
+ *        String title;
+ *        ...
+ *     }
+ *
+ *     Example 3:
+ *
+ *     @Entity
+ *     public class Student {
+ *        @Id int studentId;
+ *        ...
+ *        @ManyToMany  // students and courses are also many-many
+ *        @JoinTable(name="ENROLLMENTS",
+ *                   joinColumns=@JoinColumn(name="STUDENT"),
+ *                   inverseJoinColumns=@JoinColumn(name="SEMESTER"))
+ *        @MapKeyJoinColumn(name="COURSE")
+ *        Map<Course, Semester>  enrollment;
+ *        ...
+ *     }
+ * 
+ * + * @see ForeignKey + * + * @since Java Persistence 2.0 + */ +@Repeatable(MapKeyJoinColumns.class) +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapKeyJoinColumn { + /** + * (Optional) The name of the foreign key column for the map + * key. The table in which it is found depends upon the + * context. + *
    + *
  • If the join is for a map key for an + * element collection, the foreign key column is in the + * collection table for the map value. + *
  • If the join is for a map key for a ManyToMany entity + * relationship or for a OneToMany entity relationship + * using a join table, the foreign key column is in a join table. + *
  • If the join is for a OneToMany entity relationship using + * a foreign key mapping strategy, the foreign key column for the + * map key is in the table of the entity that is the value of the map. + *
+ * + *

Default (only applies if a single join column is used.) + * The concatenation of the following: the name of the + * referencing relationship property or field of the + * referencing entity or embeddable class; "_"; "KEY". + */ + String name() default ""; + + /** + * (Optional) The name of the column referenced by this foreign key column. + * The referenced column is in the table of the target entity. + * + *

Default (only applies if single join column is being + * used.) The same name as the primary key column of the + * referenced table + */ + String referencedColumnName() default ""; + + /** + * (Optional) Whether the property is a unique key. This is a + * shortcut for the UniqueConstraint annotation + * at the table level and is useful for when the unique key + * constraint is only a single field. + */ + boolean unique() default false; + + /** + * (Optional) Whether the foreign key column is nullable. + */ + boolean nullable() default false; + + /** + * (Optional) Whether the column is included in SQL INSERT statements + * generated by the persistence provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in SQL UPDATE statements + * generated by the persistence provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when generating the DDL for the + * column. + * Defaults to SQL generated by the provider for the column. + */ + String columnDefinition() default ""; + + /** + * (Optional) The name of the table that contains the foreign key column. + *

    + *
  • If the join is for a map key for an element collection, the foreign key + * column is in the collection table for the map value. + *
  • If the join is for a map key for a ManyToMany entity relationship + * or for a OneToMany entity relationship using a join table, + * the foreign key column is in a join table. + *
  • If the join is for a OneToMany entity relationship using a foreign + * key mapping strategy, the foreign key column for the map key is in the + * table of the entity that is the value of the map. + *
+ *

Default: + *

    + *
  • If the map is for an element collection, the + * name of the collection table for the map value. + *
  • If the map is for a OneToMany or ManyToMany entity relationship + * using a join table, the name of the join table for the map. + *
  • If the map is for a OneToMany entity relationship using a + * foreign key mapping strategy, the name of the primary table + * of the entity that is the value of the map. + *
+ */ + String table() default ""; + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint when table generation is in effect. If + * this element is not specified, the persistence provider's + * default foreign key strategy will apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); +} Index: 3rdParty_sources/persistence-api/javax/persistence/MapKeyJoinColumns.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/MapKeyJoinColumns.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/MapKeyJoinColumns.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,61 @@ +/******************************************************************************* + * 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; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Supports composite map keys that reference entities. + *

The MapKeyJoinColumns annotation groups + * MapKeyJoinColumn annotations. When the + * MapKeyJoinColumns annotation is used, both the + * name and the referencedColumnName + * elements must be specified in each of the grouped + * MapKeyJoinColumn annotations. + * + * @see MapKeyJoinColumn + * @see ForeignKey + * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapKeyJoinColumns { + /** + * (Required) The map key join columns that are used to map to the entity + * that is the map key. + */ + MapKeyJoinColumn[] value(); + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint when table generation is in effect. + * If both this element and the foreignKey + * element of any of the MapKeyJoinColumn + * elements are specified, the behavior is undefined. If no + * foreign key annotation element is specified in either + * location, the persistence provider's default foreign key + * strategy will apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); +} Index: 3rdParty_sources/persistence-api/javax/persistence/MapKeyTemporal.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/MapKeyTemporal.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/MapKeyTemporal.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,54 @@ +/******************************************************************************* + * 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; + +/** + * This annotation must be specified for persistent map keys of type + * {@link java.util.Date} and {@link java.util.Calendar}. It may only be + * specified for map keys of these types. + * + *

The MapKeyTemporal annotation can be applied to an + * element collection or relationship of type java.util.Map + * in conjunction with the ElementCollection, + * OneToMany, or ManyToMany annotation. + * + *

+ *     Example:
+ * 
+ *     @OneToMany
+ *     @MapKeyTemporal(DATE)
+ *     protected java.util.Map<java.util.Date, Employee> employees;
+ * 
+ * + * @since Java Persistence 2.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface MapKeyTemporal { + + /** (Required) The type used in mapping + * java.util.Date or + * java.util.Calendar. + */ + TemporalType value(); +} + Index: 3rdParty_sources/persistence-api/javax/persistence/MappedSuperclass.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/MappedSuperclass.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/MappedSuperclass.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,100 @@ +/******************************************************************************* + * 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; + +/** + * Designates a class whose mapping information is applied + * to the entities that inherit from it. A mapped superclass + * has no separate table defined for it. + * + *

A class designated with the MappedSuperclass + * annotation can be mapped in the same way as an entity except that the + * mappings will apply only to its subclasses since no table + * exists for the mapped superclass itself. When applied to the + * subclasses the inherited mappings will apply in the context + * of the subclass tables. Mapping information may be overridden + * in such subclasses by using the AttributeOverride and + * AssociationOverride annotations or corresponding XML elements. + * + *

+ *    Example: Concrete class as a mapped superclass
+ *
+ *    @MappedSuperclass
+ *    public class Employee {
+ *    
+ *        @Id protected Integer empId;
+ *        @Version protected Integer version;
+ *        @ManyToOne @JoinColumn(name="ADDR")
+ *        protected Address address;
+ *    
+ *        public Integer getEmpId() { ... }
+ *        public void setEmpId(Integer id) { ... }
+ *        public Address getAddress() { ... }
+ *        public void setAddress(Address addr) { ... }
+ *    }
+ *    
+ *    // Default table is FTEMPLOYEE table
+ *    @Entity
+ *    public class FTEmployee extends Employee {
+ *    
+ *        // Inherited empId field mapped to FTEMPLOYEE.EMPID
+ *        // Inherited version field mapped to FTEMPLOYEE.VERSION
+ *        // Inherited address field mapped to FTEMPLOYEE.ADDR fk
+ *    
+ *        // Defaults to FTEMPLOYEE.SALARY
+ *        protected Integer salary;
+ *    
+ *        public FTEmployee() {}
+ *    
+ *        public Integer getSalary() { ... }
+ *    
+ *        public void setSalary(Integer salary) { ... }
+ *    }
+ *    
+ *    @Entity @Table(name="PT_EMP")
+ *    @AssociationOverride(
+ *        name="address", 
+ *        joincolumns=@JoinColumn(name="ADDR_ID"))
+ *    public class PartTimeEmployee extends Employee {
+ *    
+ *        // Inherited empId field mapped to PT_EMP.EMPID
+ *        // Inherited version field mapped to PT_EMP.VERSION
+ *        // address field mapping overridden to PT_EMP.ADDR_ID fk
+ *        @Column(name="WAGE")
+ *        protected Float hourlyWage;
+ *    
+ *        public PartTimeEmployee() {}
+ *    
+ *        public Float getHourlyWage() { ... }
+ *        public void setHourlyWage(Float wage) { ... }
+ *    }
+ * 
+ * + * @see AttributeOverride + * @see AssociationOverride + * @since Java Persistence 1.0 + */ +@Documented +@Target({TYPE}) +@Retention(RUNTIME) +public @interface MappedSuperclass { +} Index: 3rdParty_sources/persistence-api/javax/persistence/MapsId.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/MapsId.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/MapsId.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,77 @@ +/******************************************************************************* + * 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; + +/** + * Designates a ManyToOne or + * OneToOne relationship attribute that provides the + * mapping for an {@link EmbeddedId} primary key, an attribute within + * an EmbeddedId primary key, or a simple primary key of + * the parent entity. The value element specifies the + * attribute within a composite key to which the relationship + * attribute corresponds. If the entity's primary key is of the same + * Java type as the primary key of the entity referenced by the + * relationship, the value attribute is not specified. + * + *
+ *    Example:
+ *
+ *    // parent entity has simple primary key
+ *
+ *    @Entity
+ *    public class Employee {
+ *       @Id long empId;
+ *       String name;
+ *       ...
+ *    } 
+ *
+ *    // dependent entity uses EmbeddedId for composite key
+ *
+ *    @Embeddable
+ *    public class DependentId {
+ *       String name;
+ *       long empid;   // corresponds to primary key type of Employee
+ *    }
+ *
+ *    @Entity
+ *    public class Dependent {
+ *       @EmbeddedId DependentId id;
+ *        ...
+ *       @MapsId("empid")  //  maps the empid attribute of embedded id
+ *       @ManyToOne Employee emp;
+ *    }
+ * 
+ * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapsId { + + /** + * (Optional) The name of the attribute within the composite key + * to which the relationship attribute corresponds. If not + * supplied, the relationship maps the entity's primary + * key. + */ + String value() default ""; } Index: 3rdParty_sources/persistence-api/javax/persistence/NamedAttributeNode.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedAttributeNode.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedAttributeNode.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ + +package javax.persistence; + +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * A NamedAttributeNode is a member element of a + * NamedEntityGraph. + * + * @see NamedEntityGraph + * @see NamedSubgraph + * + * @since Java Persistence 2.1 + */ +@Target({}) +@Retention(RUNTIME) +public @interface NamedAttributeNode { + + /** + * (Required) The name of the attribute that must be included in the graph. + */ + String value(); + + /** + * (Optional) If the attribute references a managed type that has + * its own AttributeNodes, this element is used to refer to that + * NamedSubgraph definition. + * If the target type has inheritance, multiple subgraphs can + * be specified. These additional subgraphs are intended to add + * subclass-specific attributes. Superclass subgraph entries will + * be merged into subclass subgraphs. + * + *

The value of this element is the name of the subgraph as + * specified by the name element of the corresponding + * NamedSubgraph element. If multiple subgraphs are + * specified due to inheritance, they are referenced by this name. + */ + String subgraph() default ""; + + /** + * (Optional) If the attribute references a Map type, this element + * can be used to specify a subgraph for the Key in the case of an + * Entity key type. A keySubgraph can not be specified without the + * Map attribute also being specified. If the target type has + * inheritance, multiple subgraphs can be specified. These + * additional subgraphs are intended to add subclass-specific + * attributes. Superclass subgraph entries will be merged into + * subclass subgraphs. + * + *

The value of this element is the name of the key subgraph as + * specified by the name element of the corresponding + * NamedSubgraph element. If multiple key subgraphs + * are specified due to inheritance, they are referenced by this + * name. + */ + String keySubgraph() default ""; +} + + Index: 3rdParty_sources/persistence-api/javax/persistence/NamedEntityGraph.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedEntityGraph.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedEntityGraph.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * + ******************************************************************************/ + +package javax.persistence; + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to specify the path and boundaries for a find operation or query. + * + * @since Java Persistence 2.1 + */ +@Repeatable(NamedEntityGraphs.class) +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedEntityGraph { + + /** + * (Optional) The name of the entity graph. + * Defaults to the entity name of the root entity. + */ + String name() default ""; + + /** + * (Optional) A list of attributes of the entity that are included in + * this graph. + */ + NamedAttributeNode[] attributeNodes() default {}; + + /** + * (Optional) Includes all of the attributes of the annotated + * entity class as attribute nodes in the NamedEntityGraph without + * the need to explicitly list them. Included attributes can + * still be fully specified by an attribute node referencing a + * subgraph. + */ + boolean includeAllAttributes() default false; + + /** + * (Optional) A list of subgraphs that are included in the + * entity graph. These are referenced by name from NamedAttributeNode + * definitions. + */ + NamedSubgraph[] subgraphs() default {}; + + /** + * (Optional) A list of subgraphs that will add additional + * attributes for subclasses of the annotated entity class to the + * entity graph. Specified attributes from superclasses are + * included in subclasses. + */ + NamedSubgraph[] subclassSubgraphs() default {}; +} + Index: 3rdParty_sources/persistence-api/javax/persistence/NamedEntityGraphs.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedEntityGraphs.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedEntityGraphs.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ + +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; + +/** + * Used to group NamedEntityGraph annotations. + * + * @see NamedEntityGraph + * @since Java Persistence 2.1 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedEntityGraphs{ + NamedEntityGraph[] value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/NamedNativeQueries.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedNativeQueries.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedNativeQueries.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,38 @@ +/******************************************************************************* + * 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 multiple native SQL named queries. Query names + * are scoped to the persistence unit. The NamedNativeQueries + * annotation can be applied to an entity or mapped superclass. + * + * @see NamedNativeQuery + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedNativeQueries { + + /** (Required) Array of NamedNativeQuery annotations. */ + NamedNativeQuery[] value (); +} Index: 3rdParty_sources/persistence-api/javax/persistence/NamedNativeQuery.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedNativeQuery.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedNativeQuery.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +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 a named native SQL query. + * Query names are scoped to the persistence unit. + * The NamedNativeQuery annotation can be applied to an + * entity or mapped superclass. + * + * @since Java Persistence 1.0 + */ +@Repeatable(NamedNativeQueries.class) +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedNativeQuery { + + /** + * The name used to refer to the query with the {@link EntityManager} + * methods that create query objects. + */ + String name(); + + /** The SQL query string. */ + String query(); + + /** Query properties and hints. (May include vendor-specific query hints.) */ + QueryHint[] hints() default {}; + + /** The class of the result. */ + Class resultClass() default void.class; + + /** The name of a {@link SqlResultSetMapping}, as defined in metadata. */ + String resultSetMapping() default ""; +} Index: 3rdParty_sources/persistence-api/javax/persistence/NamedQueries.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedQueries.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedQueries.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,38 @@ +/******************************************************************************* + * 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 multiple named Java Persistence query language queries. + * Query names are scoped to the persistence unit. + * The NamedQueries annotation can be applied to an entity or mapped superclass. + * + * @see NamedQuery + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedQueries { + + /** (Required) An array of NamedQuery annotations. */ + NamedQuery [] value (); +} Index: 3rdParty_sources/persistence-api/javax/persistence/NamedQuery.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedQuery.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedQuery.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import static javax.persistence.LockModeType.NONE; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a static, named query in the Java Persistence query language. + * Query names are scoped to the persistence unit. + * The NamedQuery annotation can be applied to an entity or mapped superclass. + * + *

The following is an example of the definition of a named query + * in the Java Persistence query language: + * + *

+ *    @NamedQuery(
+ *            name="findAllCustomersWithName",
+ *            query="SELECT c FROM Customer c WHERE c.name LIKE :custName"
+ *    )
+ * 
+ * + *

The following is an example of the use of a named query: + * + *

+ *    @PersistenceContext
+ *    public EntityManager em;
+ *    ...
+ *    customers = em.createNamedQuery("findAllCustomersWithName")
+ *            .setParameter("custName", "Smith")
+ *            .getResultList();
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Repeatable(NamedQueries.class) +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedQuery { + + /** + * (Required) The name used to refer to the query with the {@link EntityManager} + * methods that create query objects. + */ + String name(); + + /** (Required) + * The query string in the Java Persistence query language. + */ + String query(); + + /** + * (Optional) The lock mode type to use in query execution. If a lockMode + * other than LockModeType.NONE is specified, the query must be executed in + * a transaction and the persistence context joined to the transaction. + * @since Java Persistence 2.0 + */ + LockModeType lockMode() default NONE; + + /** (Optional) Query properties and hints. May include + * vendor-specific query hints. + */ + QueryHint[] hints() default {}; +} Index: 3rdParty_sources/persistence-api/javax/persistence/NamedStoredProcedureQueries.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedStoredProcedureQueries.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedStoredProcedureQueries.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ +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 multiple named stored procedure queries. Query names + * are scoped to the persistence unit. The NamedStoredProcedureQueries + * annotation can be applied to an entity or mapped superclass. + * + * @see NamedStoredProcedureQuery + * + * @since Java Persistence 2.1 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedStoredProcedureQueries { + + /** (Required) Array of NamedStoredProcedureQuery annotations. */ + NamedStoredProcedureQuery[] value (); +} Index: 3rdParty_sources/persistence-api/javax/persistence/NamedStoredProcedureQuery.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedStoredProcedureQuery.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedStoredProcedureQuery.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,101 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +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 and names a stored procedure, its parameters, and its result type. + * + *

The NamedStoredProcedureQuery annotation can be applied to an + * entity or mapped superclass. + * + *

The name element is the name that is passed as an argument to the + * {@link EntityManager#createNamedStoredProcedureQuery} + * method to create an executable StoredProcedureQuery object. + * Names are scoped to the persistence unit. + * + *

The procedureName element is the name of the stored procedure in + * the database. + * + *

The parameters of the stored procedure are specified by the + * parameters element. All parameters must be specified in the order in + * which they occur in the parameter list of the stored procedure. + * + *

The resultClasses element refers to the class (or classes) that are + * used to map the results. The resultSetMappings element names one or + * more result set mappings, as defined by the {@link SqlResultSetMapping} + * annotation. + * + *

If there are multiple result sets, it is assumed that they will be + * mapped using the same mechanism — e.g., either all via a set of + * result class mappings or all via a set of result set mappings. The + * order of the specification of these mappings must be the same as + * the order in which the result sets will be returned by the stored + * procedure invocation. If the stored procedure returns one or more + * result sets and no resultClasses or resultSetMappings + * element is specified, any result set will be returned as a list of type + * Object[]. The combining of different strategies for the mapping of + * stored procedure result sets is undefined. + * + *

The hints element may be used to specify query properties and + * hints. Properties defined by this specification must be observed by + * the provider. Vendor-specific hints that are not recognized by a + * provider must be ignored. + * + *

All parameters of a named stored procedure query must be specified + * using the StoredProcedureParameter annotation. + * + * @see StoredProcedureQuery + * @see StoredProcedureParameter + * + * @since Java Persistence 2.1 + */ +@Repeatable(NamedStoredProcedureQueries.class) +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedStoredProcedureQuery { + + /** + * The name used to refer to the query with the {@link EntityManager} + * methods that create stored procedure query objects. + */ + String name(); + + /** The name of the stored procedure in the database. */ + String procedureName(); + + /** + * Information about all parameters of the stored procedure. + * All parameters must be specified in the order in which they + * occur in the parameter list of the stored procedure. + */ + StoredProcedureParameter[] parameters() default {}; + + /** The class or classes that are used to map the results. */ + Class[] resultClasses() default {}; + + /** The names of one or more result set mappings, as defined in metadata. */ + String[] resultSetMappings() default {}; + + /** Query properties and hints. (May include vendor-specific query hints.) */ + QueryHint[] hints() default {}; + +} Index: 3rdParty_sources/persistence-api/javax/persistence/NamedSubgraph.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NamedSubgraph.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NamedSubgraph.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ + +package javax.persistence; + +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * A NamedSubgraph is a member element of a + * NamedEntityGraph. The NamedSubgraph is + * only referenced from within a NamedEntityGraph and can not be + * referenced independently. It is referenced by its name + * from a NamedAttributeNode element of the + * NamedEntityGraph. + * + * @see NamedEntityGraph + * @see NamedAttributeNode + * + * @since Java Persistence 2.1 + */ +@Target({}) +@Retention(RUNTIME) +public @interface NamedSubgraph { + + /** + * (Required) The name of the subgraph as referenced from a + * NamedAttributeNode element. + */ + String name(); + + /** + * (Optional) The type represented by this subgraph. The element + * must be specified when this subgraph is extending a definition + * on behalf of a subclass. + */ + Class type() default void.class; + + /** + * (Required) The list of the attributes of the class that must + * be included. If the named subgraph corresponds to a subclass + * of the class referenced by the corresponding attribute node, + * then only subclass-specific attributes are listed. + */ + NamedAttributeNode[] attributeNodes(); +} + + Index: 3rdParty_sources/persistence-api/javax/persistence/NoResultException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NoResultException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NoResultException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,51 @@ +/******************************************************************************* + * 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; + +/** + * Thrown by the persistence provider when {@link + * Query#getSingleResult Query.getSingleResult()} or {@link + * TypedQuery#getSingleResult TypedQuery.getSingleResult()}is executed on a query + * and there is no result to return. This exception will not cause + * the current transaction, if one is active, to be marked for + * rollback. + * + * @see Query#getSingleResult() + * @see TypedQuery#getSingleResult() + * + * @since Java Persistence 1.0 + */ +public class NoResultException extends PersistenceException { + + /** + * Constructs a new NoResultException exception with + * null as its detail message. + */ + public NoResultException() { + super(); + } + + /** + * Constructs a new NoResultException exception with the + * specified detail message. + * + * @param message + * the detail message. + */ + public NoResultException(String message) { + super(message); + } +} Index: 3rdParty_sources/persistence-api/javax/persistence/NonUniqueResultException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/NonUniqueResultException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/NonUniqueResultException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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; + +/** + * Thrown by the persistence provider when {@link + * Query#getSingleResult Query.getSingleResult()} or {@link + * TypedQuery#getSingleResult TypedQuery.getSingleResult()} is executed on a + * query and there is more than one result from the query. This + * exception will not cause the current transaction, if one is active, + * to be marked for rollback. + * + * @see Query#getSingleResult() + * @see TypedQuery#getSingleResult() + * + * @since Java Persistence 1.0 + */ +public class NonUniqueResultException extends PersistenceException { + + /** + * Constructs a new NonUniqueResultException exception + * with null as its detail message. + */ + public NonUniqueResultException() { + super(); + } + + /** + * Constructs a new NonUniqueResultException exception + * with the specified detail message. + * @param message the detail message. + */ + public NonUniqueResultException(String message) { + super(message); + } +} + Index: 3rdParty_sources/persistence-api/javax/persistence/OneToMany.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/OneToMany.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/OneToMany.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,136 @@ +/******************************************************************************* + * 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 javax.persistence.CascadeType; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static javax.persistence.FetchType.LAZY; + +/** + * Specifies a many-valued association with one-to-many multiplicity. + * + *

If the collection is defined using generics to specify the + * element type, the associated target entity type need not be + * specified; otherwise the target entity class must be specified. + * If the relationship is bidirectional, the + * mappedBy element must be used to specify the relationship field or + * property of the entity that is the owner of the relationship. + * + *

The OneToMany annotation may be used within an embeddable class + * contained within an entity class to specify a relationship to a + * collection of entities. If the relationship is bidirectional, the + * mappedBy element must be used to specify the relationship field or + * property of the entity that is the owner of the relationship. + * + * When the collection is a java.util.Map, the cascade + * element and the orphanRemoval element apply to the map value. + * + *

+ *
+ *    Example 1: One-to-Many association using generics
+ *
+ *    // In Customer class:
+ *
+ *    @OneToMany(cascade=ALL, mappedBy="customer")
+ *    public Set<Order> getOrders() { return orders; }
+ *
+ *    In Order class:
+ *
+ *    @ManyToOne
+ *    @JoinColumn(name="CUST_ID", nullable=false)
+ *    public Customer getCustomer() { return customer; }
+ *
+ *
+ *    Example 2: One-to-Many association without using generics
+ *
+ *    // In Customer class:
+ *
+ *    @OneToMany(targetEntity=com.acme.Order.class, cascade=ALL,
+ *                mappedBy="customer")
+ *    public Set getOrders() { return orders; }
+ *
+ *    // In Order class:
+ *
+ *    @ManyToOne
+ *    @JoinColumn(name="CUST_ID", nullable=false)
+ *    public Customer getCustomer() { return customer; }
+ *
+ *
+ *    Example 3: Unidirectional One-to-Many association using a foreign key mapping
+ *
+ *    // In Customer class:
+ *
+ *    @OneToMany(orphanRemoval=true)
+ *    @JoinColumn(name="CUST_ID") // join column is in table for Order
+ *    public Set<Order> getOrders() {return orders;}
+ *    
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface OneToMany { + + /** + * (Optional) The entity class that is the target + * of the association. Optional only if the collection + * property is defined using Java generics. + * Must be specified otherwise. + * + *

Defaults to the parameterized type of + * the collection when defined using generics. + */ + Class targetEntity() default void.class; + + /** + * (Optional) The operations that must be cascaded to + * the target of the association. + *

Defaults to no operations being cascaded. + * + *

When the target collection is a {@link java.util.Map + * java.util.Map}, the cascade element applies to the + * map value. + */ + CascadeType[] cascade() default {}; + + /** (Optional) Whether the association should be lazily loaded or + * must be eagerly fetched. The EAGER strategy is a requirement on + * the persistence provider runtime that the associated entities + * must be eagerly fetched. The LAZY strategy is a hint to the + * persistence provider runtime. + */ + FetchType fetch() default LAZY; + + /** + * The field that owns the relationship. Required unless + * the relationship is unidirectional. + */ + String mappedBy() default ""; + + /** + * (Optional) Whether to apply the remove operation to entities that have + * been removed from the relationship and to cascade the remove operation to + * those entities. + * @since Java Persistence 2.0 + */ + boolean orphanRemoval() default false; +} Index: 3rdParty_sources/persistence-api/javax/persistence/OneToOne.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/OneToOne.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/OneToOne.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,164 @@ +/******************************************************************************* + * 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 javax.persistence.CascadeType; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static javax.persistence.FetchType.EAGER; + +/** + * Specifies a single-valued association to another entity that has + * one-to-one multiplicity. It is not normally necessary to specify + * the associated target entity explicitly since it can usually be + * inferred from the type of the object being referenced. If the relationship is + * bidirectional, the non-owning side must use the mappedBy element of + * the OneToOne annotation to specify the relationship field or + * property of the owning side. + * + *

The OneToOne annotation may be used within an + * embeddable class to specify a relationship from the embeddable + * class to an entity class. If the relationship is bidirectional and + * the entity containing the embeddable class is on the owning side of + * the relationship, the non-owning side must use the + * mappedBy element of the OneToOne + * annotation to specify the relationship field or property of the + * embeddable class. The dot (".") notation syntax must be used in the + * mappedBy element to indicate the relationship attribute within the + * embedded attribute. The value of each identifier used with the dot + * notation is the name of the respective embedded field or property. + * + *

+ *    Example 1: One-to-one association that maps a foreign key column
+ *
+ *    // On Customer class:
+ *
+ *    @OneToOne(optional=false)
+ *    @JoinColumn(
+ *    	name="CUSTREC_ID", unique=true, nullable=false, updatable=false)
+ *    public CustomerRecord getCustomerRecord() { return customerRecord; }
+ *
+ *    // On CustomerRecord class:
+ *
+ *    @OneToOne(optional=false, mappedBy="customerRecord")
+ *    public Customer getCustomer() { return customer; }
+ *
+ *
+ *    Example 2: One-to-one association that assumes both the source and target share the same primary key values. 
+ *
+ *    // On Employee class:
+ *
+ *    @Entity
+ *    public class Employee {
+ *    	@Id Integer id;
+ *    
+ *    	@OneToOne @MapsId
+ *    	EmployeeInfo info;
+ *    	...
+ *    }
+ *
+ *    // On EmployeeInfo class:
+ *
+ *    @Entity
+ *    public class EmployeeInfo {
+ *    	@Id Integer id;
+ *    	...
+ *    }
+ *
+ *
+ *    Example 3: One-to-one association from an embeddable class to another entity.
+ *
+ *    @Entity
+ *    public class Employee {
+ *       @Id int id;
+ *       @Embedded LocationDetails location;
+ *       ...
+ *    }
+ *
+ *    @Embeddable
+ *    public class LocationDetails {
+ *       int officeNumber;
+ *       @OneToOne ParkingSpot parkingSpot;
+ *       ...
+ *    }
+ *
+ *    @Entity
+ *    public class ParkingSpot {
+ *       @Id int id;
+ *       String garage;
+ *       @OneToOne(mappedBy="location.parkingSpot") Employee assignedTo;
+ *        ... 
+ *    } 
+ *
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface OneToOne { + + /** + * (Optional) The entity class that is the target of + * the association. + * + *

Defaults to the type of the field or property + * that stores the association. + */ + Class targetEntity() default void.class; + + /** + * (Optional) The operations that must be cascaded to + * the target of the association. + * + *

By default no operations are cascaded. + */ + CascadeType[] cascade() default {}; + + /** + * (Optional) Whether the association should be lazily + * loaded or must be eagerly fetched. The EAGER + * strategy is a requirement on the persistence provider runtime that + * the associated entity must be eagerly fetched. The LAZY + * strategy is a hint to the persistence provider runtime. + */ + FetchType fetch() default EAGER; + + /** + * (Optional) Whether the association is optional. If set + * to false then a non-null relationship must always exist. + */ + boolean optional() default true; + + /** (Optional) The field that owns the relationship. This + * element is only specified on the inverse (non-owning) + * side of the association. + */ + String mappedBy() default ""; + + + /** + * (Optional) Whether to apply the remove operation to entities that have + * been removed from the relationship and to cascade the remove operation to + * those entities. + * @since Java Persistence 2.0 + */ + boolean orphanRemoval() default false; +} Index: 3rdParty_sources/persistence-api/javax/persistence/OptimisticLockException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/OptimisticLockException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/OptimisticLockException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,117 @@ +/******************************************************************************* + * 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; + +/** + * Thrown by the persistence provider when an optimistic locking conflict + * occurs. This exception may be thrown as part of an API call, a flush or at + * commit time. The current transaction, if one is active, will be marked for + * rollback. + * + * @see EntityManager#find(Class, Object, LockModeType) + * @see EntityManager#find(Class, Object, LockModeType, java.util.Map) + * @see EntityManager#lock(Object, LockModeType) + * @see EntityManager#lock(Object, LockModeType, java.util.Map) + * + * @since Java Persistence 1.0 + */ +public class OptimisticLockException extends PersistenceException { + + /** + * The object that caused the exception + */ + Object entity; + + /** + * Constructs a new OptimisticLockException exception with + * null as its detail message. + */ + public OptimisticLockException() { + super(); + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified detail message. + * + * @param message + * the detail message. + */ + public OptimisticLockException(String message) { + super(message); + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified detail message and cause. + * + * @param message + * the detail message. + * @param cause + * the cause. + */ + public OptimisticLockException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified cause. + * + * @param cause + * the cause. + */ + public OptimisticLockException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified entity. + * + * @param entity + * the entity. + */ + public OptimisticLockException(Object entity) { + this.entity = entity; + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified detail message, cause, and entity. + * + * @param message + * the detail message. + * @param cause + * the cause. + * @param entity + * the entity. + */ + public OptimisticLockException(String message, Throwable cause, Object entity) { + super(message, cause); + this.entity = entity; + } + + /** + * Returns the entity that caused this exception. + * + * @return the entity. + */ + public Object getEntity() { + return this.entity; + } + +} Index: 3rdParty_sources/persistence-api/javax/persistence/OrderBy.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/OrderBy.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/OrderBy.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,137 @@ +/******************************************************************************* + * 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 ordering of the elements of a collection valued + * association or element collection at the point when the association + * or collection is retrieved. + * + *

The syntax of the value ordering element is an + * orderby_list, as follows: + * + *

+ *    orderby_list::= orderby_item [,orderby_item]*
+ *    orderby_item::= [property_or_field_name] [ASC | DESC]
+ * 
+ * + *

If ASC or DESC is not specified, + * ASC (ascending order) is assumed. + * + *

If the ordering element is not specified for an entity association, + * ordering by the primary key of the associated entity is assumed. + * + *

The property or field name must correspond to that of a + * persistent property or field of the associated class or embedded class + * within it. The properties or fields used in the ordering must correspond to + * columns for which comparison operators are supported. + * + *

The dot (".") notation is used to refer to an attribute within an + * embedded attribute. The value of each identifier used with the dot + * notation is the name of the respective embedded field or property. + * + *

The OrderBy annotation may be applied to an element + * collection. When OrderBy is applied to an element collection of + * basic type, the ordering will be by value of the basic objects and + * the property or field name is not used. When specifying an ordering + * over an element collection of embeddable type, the dot notation + * must be used to specify the attribute or attributes that determine + * the ordering. + * + *

The OrderBy annotation is not used when an order + * column is specified. + * + * + *

+ *    Example 1:
+ *    
+ *    @Entity 
+ *    public class Course {
+ *       ...
+ *       @ManyToMany
+ *       @OrderBy("lastname ASC")
+ *       public List<Student> getStudents() {...};
+ *       ...
+ *    }
+ *    
+ *    Example 2:
+ *
+ *    @Entity 
+ *    public class Student {
+ *       ...
+ *       @ManyToMany(mappedBy="students")
+ *       @OrderBy // ordering by primary key is assumed
+ *       public List<Course> getCourses() {...};
+ *       ...
+ *    }
+ *
+ *    Example 3: 
+ *
+ *    @Entity 
+ *    public class Person {
+ *         ...
+ *       @ElementCollection
+ *       @OrderBy("zipcode.zip, zipcode.plusFour")
+ *       public Set<Address> getResidences() {...};
+ *       ...
+ *    }
+ *  
+ *    @Embeddable 
+ *    public class Address {
+ *       protected String street;
+ *       protected String city;
+ *       protected String state;
+ *       @Embedded protected Zipcode zipcode;
+ *    }
+ *
+ *    @Embeddable 
+ *    public class Zipcode {
+ *       protected String zip;
+ *       protected String plusFour;
+ *    }
+ * 
+ * + * @see OrderColumn + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface OrderBy { + + /** + * An orderby_list. Specified as follows: + * + *
+    *    orderby_list::= orderby_item [,orderby_item]*
+    *    orderby_item::= [property_or_field_name] [ASC | DESC]
+    * 
+ * + *

If ASC or DESC is not specified, + * ASC (ascending order) is assumed. + * + *

If the ordering element is not specified, ordering by + * the primary key of the associated entity is assumed. + */ + String value() default ""; +} Index: 3rdParty_sources/persistence-api/javax/persistence/OrderColumn.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/OrderColumn.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/OrderColumn.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,100 @@ +/******************************************************************************* + * 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 a column that is used to maintain the persistent order of + * a list. The persistence provider is responsible for maintaining the + * order upon retrieval and in the database. The persistence provider + * is responsible for updating the ordering upon flushing to the + * database to reflect any insertion, deletion, or reordering + * affecting the list. + * + *

The OrderColumn annotation is specified on a + * OneToMany or ManyToMany relationship or on an element + * collection. The OrderColumn annotation is specified on + * the side of the relationship that references the collection that is + * to be ordered. The order column is not visible as part of the state + * of the entity or embeddable class. + * + *

The {@link OrderBy} annotation should be used for ordering that + * is visible as persistent state and maintained by the + * application. The OrderBy annotation is not used when + * OrderColumn is specified. + * + *

The order column must be of integral type. The persistence + * provider maintains a contiguous (non-sparse) ordering of the values + * of the order column when updating the association or element collection. + * The order column value for the first element is 0. + * + *

+ *
+ *    Example:
+ *
+ *    @Entity
+ *    public class CreditCard {
+ *
+ *       @Id long ccNumber;
+ *
+ *       @OneToMany  // unidirectional
+ *       @OrderColumn
+ *       List<CardTransaction> transactionHistory;
+ *       ...
+ *    }
+ *
+ * 
+ * + * @see OrderBy + * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface OrderColumn { + + /** (Optional) The name of the ordering column. + * Defaults to the concatenation of the name of the + * referencing property or field; "_"; "ORDER". + */ + String name() default ""; + + /** (Optional) Whether the database column is nullable. */ + boolean nullable() default true; + + /** + * (Optional) Whether the column is included in SQL INSERT statements + * generated by the persistence provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in SQL UPDATE statements + * generated by the persistence provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when generating the DDL for the + * column. Defaults to generated SQL to create a column of the inferred type. + */ + String columnDefinition() default ""; +} Index: 3rdParty_sources/persistence-api/javax/persistence/Parameter.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Parameter.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Parameter.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,58 @@ +/******************************************************************************* + * 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; + +/** + * Type for query parameter objects. + * @param the type of the parameter + * + * @see Query + * @see TypedQuery + * + * @since Java Persistence 2.0 + */ +public interface Parameter { + + /** + * Return the parameter name, or null if the parameter is + * not a named parameter or no name has been assigned. + * @return parameter name + */ + String getName(); + + /** + * Return the parameter position, or null if the parameter + * is not a positional parameter. + * @return position of parameter + */ + Integer getPosition(); + + /** + * Return the Java type of the parameter. Values bound to the + * parameter must be assignable to this type. + * This method is required to be supported for criteria queries + * only. Applications that use this method for Java + * Persistence query language queries and native queries will + * not be portable. + * @return the Java type of the parameter + * @throws IllegalStateException if invoked on a parameter + * obtained from a Java persistence query language + * query or native query when the implementation does + * not support this use + */ + Class getParameterType(); +} + Index: 3rdParty_sources/persistence-api/javax/persistence/ParameterMode.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ParameterMode.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ParameterMode.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2017 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 + * + ******************************************************************************/ +package javax.persistence; + +/** + * Specifies the mode of a parameter of a stored procedure query. + * + * @see StoredProcedureQuery + * @see StoredProcedureParameter + * + * @since Java Persistence 2.1 + */ +public enum ParameterMode { + + /** + * Stored procedure input parameter + */ + IN, + + /** + * Stored procedure input/output parameter + */ + INOUT, + + /** + * Stored procedure output parameter + */ + OUT, + + /** + * Stored procedure reference cursor parameter. Some databases use + * REF_CURSOR parameters to return result sets from stored procedures. + */ + REF_CURSOR, + +} Index: 3rdParty_sources/persistence-api/javax/persistence/Persistence.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Persistence.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Persistence.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,199 @@ +/******************************************************************************* + * 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.util.List; +import java.util.Map; +import java.util.Set; +import java.util.HashSet; +import javax.persistence.spi.PersistenceProvider; +import javax.persistence.spi.PersistenceProviderResolver; +import javax.persistence.spi.PersistenceProviderResolverHolder; +import javax.persistence.spi.LoadState; + +/** + * Bootstrap class that is used to obtain an {@link EntityManagerFactory} + * in Java SE environments. It may also be used to cause schema + * generation to occur. + * + *

The Persistence class is available in a Java EE + * container environment as well; however, support for the Java SE + * bootstrapping APIs is not required in container environments. + * + *

The Persistence class is used to obtain a {@link + * javax.persistence.PersistenceUtil PersistenceUtil} instance in both + * Java EE and Java SE environments. + * + * @since Java Persistence 1.0 + */ +public class Persistence { + + /** + * Create and return an EntityManagerFactory for the named + * persistence unit. + * + * @param persistenceUnitName + * the name of the persistence unit + * @return the factory that creates EntityManagers configured according to + * the specified persistence unit + */ + public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName) { + return createEntityManagerFactory(persistenceUnitName, null); + } + + /** + * Create and return an EntityManagerFactory for the named persistence unit + * using the given properties. + * + * @param persistenceUnitName + * the name of the persistence unit + * @param properties + * Additional properties to use when creating the factory. + * These properties may include properties to control + * schema generation. The values of these properties override + * any values that may have been configured elsewhere. + * @return the factory that creates EntityManagers configured according to + * the specified persistence unit. + */ + public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) { + + EntityManagerFactory emf = null; + PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver(); + + List providers = resolver.getPersistenceProviders(); + + for (PersistenceProvider provider : providers) { + emf = provider.createEntityManagerFactory(persistenceUnitName, properties); + if (emf != null) { + break; + } + } + if (emf == null) { + throw new PersistenceException("No Persistence provider for EntityManager named " + persistenceUnitName); + } + return emf; + } + + + /** + * Create database schemas and/or tables and/or create DDL + * scripts as determined by the supplied properties. + *

+ * Called when schema generation is to occur as a separate phase + * from creation of the entity manager factory. + *

+ * @param persistenceUnitName the name of the persistence unit + * @param map properties for schema generation; these may + * also contain provider-specific properties. The + * value of these properties override any values that + * may have been configured elsewhere.. + * @throws PersistenceException if insufficient or inconsistent + * configuration information is provided or if schema + * generation otherwise fails. + * + * @since Java Persistence 2.1 + */ + public static void generateSchema(String persistenceUnitName, Map map) { + PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver(); + List providers = resolver.getPersistenceProviders(); + + for (PersistenceProvider provider : providers) { + if (provider.generateSchema(persistenceUnitName, map)) { + return; + } + } + + throw new PersistenceException("No Persistence provider to generate schema named " + persistenceUnitName); + } + + + /** + * Return the PersistenceUtil instance + * @return PersistenceUtil instance + * @since Java Persistence 2.0 + */ + public static PersistenceUtil getPersistenceUtil() { + return new PersistenceUtilImpl(); + } + + + /** + * Implementation of PersistenceUtil interface + * @since Java Persistence 2.0 + */ + private static class PersistenceUtilImpl implements PersistenceUtil { + public boolean isLoaded(Object entity, String attributeName) { + PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver(); + + List providers = resolver.getPersistenceProviders(); + + for (PersistenceProvider provider : providers) { + LoadState loadstate = provider.getProviderUtil().isLoadedWithoutReference(entity, attributeName); + if(loadstate == LoadState.LOADED) { + return true; + } else if (loadstate == LoadState.NOT_LOADED) { + return false; + } // else continue + } + + //None of the providers could determine the load state try isLoadedWithReference + for (PersistenceProvider provider : providers) { + LoadState loadstate = provider.getProviderUtil().isLoadedWithReference(entity, attributeName); + if(loadstate == LoadState.LOADED) { + return true; + } else if (loadstate == LoadState.NOT_LOADED) { + return false; + } // else continue + } + + //None of the providers could determine the load state. + return true; + } + + public boolean isLoaded(Object entity) { + PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver(); + + List providers = resolver.getPersistenceProviders(); + + for (PersistenceProvider provider : providers) { + LoadState loadstate = provider.getProviderUtil().isLoaded(entity); + if(loadstate == LoadState.LOADED) { + return true; + } else if (loadstate == LoadState.NOT_LOADED) { + return false; + } // else continue + } + //None of the providers could determine the load state + return true; + } + } + + /** + * This final String is deprecated and should be removed and is only here for TCK backward compatibility + * @since Java Persistence 1.0 + * @deprecated + */ + @Deprecated + public static final String PERSISTENCE_PROVIDER = "javax.persistence.spi.PeristenceProvider"; + + /** + * This instance variable is deprecated and should be removed and is only here for TCK backward compatibility + * @since Java Persistence 1.0 + * @deprecated + */ + @Deprecated + protected static final Set providers = new HashSet(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/PersistenceContext.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PersistenceContext.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PersistenceContext.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2017 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Target; +import static java.lang.annotation.ElementType.*; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.*; + +/** + * Expresses a dependency on a container-managed {@link EntityManager} and its + * associated persistence context. + * + * @since Java Persistence 1.0 + */ + +@Repeatable(PersistenceContexts.class) +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) +public @interface PersistenceContext { + + /** + * (Optional) The name by which the entity manager is to be accessed in the + * environment referencing context; not needed when dependency + * injection is used. + */ + String name() default ""; + + /** + * (Optional) The name of the persistence unit as defined in the + * persistence.xml file. If the unitName element is + * specified, the persistence unit for the entity manager that is + * accessible in JNDI must have the same name. + */ + String unitName() default ""; + + /** + * (Optional) Specifies whether a transaction-scoped persistence context + * or an extended persistence context is to be used. + */ + PersistenceContextType type() default PersistenceContextType.TRANSACTION; + + /** + * (Optional) Specifies whether the persistence context is always + * automatically synchronized with the current transaction or whether + * the persistence context must be explicitly joined to the current + * transaction by means of the EntityManager + * {@link EntityManager#joinTransaction joinTransaction} method. + * @since Java Persistence 2.1 + */ + SynchronizationType synchronization() default SynchronizationType.SYNCHRONIZED; + + /** + * (Optional) Properties for the container or persistence + * provider. Vendor specific properties may be included in this + * set of properties. Properties that are not recognized by + * a vendor are ignored. + */ + PersistenceProperty[] properties() default {}; +} Index: 3rdParty_sources/persistence-api/javax/persistence/PersistenceContextType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PersistenceContextType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PersistenceContextType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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; + +/** + * Specifies whether a transaction-scoped or extended + * persistence context is to be used in {@link PersistenceContext}. + * If not specified, a transaction-scoped persistence context is used. + * + * @since Java Persistence 1.0 + */ +public enum PersistenceContextType { + + /** Transaction-scoped persistence context */ + TRANSACTION, + + /** Extended persistence context */ + EXTENDED +} Index: 3rdParty_sources/persistence-api/javax/persistence/PersistenceContexts.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PersistenceContexts.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PersistenceContexts.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,39 @@ +/******************************************************************************* + * 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 static java.lang.annotation.ElementType.*; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.*; + +/** + * Declares one or more {@link PersistenceContext} annotations. + * It is used to express a dependency on container-managed + * entity manager persistence contexts. + * + *@see PersistenceContext + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface PersistenceContexts { + + /** (Required) One or more PersistenceContext annotations. */ + PersistenceContext[] value(); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/PersistenceException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PersistenceException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PersistenceException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,67 @@ +/******************************************************************************* + * 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; + + +/** + * Thrown by the persistence provider when a problem occurs. + * All instances of PersistenceException except for instances of + * {@link NoResultException}, {@link NonUniqueResultException}, + * {@link LockTimeoutException}, and {@link QueryTimeoutException} will cause + * the current transaction, if one is active and the persistence context has + * been joined to it, to be marked for rollback. + * + * @since Java Persistence 1.0 + */ +public class PersistenceException extends RuntimeException { + + /** + * Constructs a new PersistenceException exception + * with null as its detail message. + */ + public PersistenceException() { + super(); + } + + /** + * Constructs a new PersistenceException exception + * with the specified detail message. + * @param message the detail message. + */ + public PersistenceException(String message) { + super(message); + } + + /** + * Constructs a new PersistenceException exception + * with the specified detail message and cause. + * @param message the detail message. + * @param cause the cause. + */ + public PersistenceException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new PersistenceException exception + * with the specified cause. + * @param cause the cause. + */ + public PersistenceException(Throwable cause) { + super(cause); + } +} + Index: 3rdParty_sources/persistence-api/javax/persistence/PersistenceProperty.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PersistenceProperty.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PersistenceProperty.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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 static java.lang.annotation.RetentionPolicy.*; + +/** + * Describes a single container or persistence provider property. Used in {@link + * PersistenceContext}. + * + *

Vendor specific properties may be included in the set of + * properties, and are passed to the persistence provider by the + * container when the entity manager is created. Properties that + * are not recognized by a vendor will be ignored. + * + * @since Java Persistence 1.0 + */ +@Target({}) +@Retention(RUNTIME) +public @interface PersistenceProperty { + + /** The name of the property */ + String name(); + + /** The value of the property */ + String value(); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/PersistenceUnit.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PersistenceUnit.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PersistenceUnit.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Target; +import static java.lang.annotation.ElementType.*; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.*; + + +/** + * Expresses a dependency on an {@link EntityManagerFactory} and its + * associated persistence unit. + * + * @since Java Persistence 1.0 + */ +@Repeatable(PersistenceUnits.class) +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) +public @interface PersistenceUnit { + + /** + * (Optional) The name by which the entity manager factory is to be accessed + * in the environment referencing context; not needed when + * dependency injection is used. + */ + String name() default ""; + + /** + * (Optional) The name of the persistence unit as defined in the + * persistence.xml file. If specified, the + * persistence unit for the entity manager factory that is + * accessible in JNDI must have the same name. + */ + String unitName() default ""; + +} Index: 3rdParty_sources/persistence-api/javax/persistence/PersistenceUnitUtil.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PersistenceUnitUtil.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PersistenceUnitUtil.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,67 @@ +/******************************************************************************* + * 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; + +/** + * Utility interface between the application and the persistence + * provider managing the persistence unit. + * + *

The methods of this interface should only be invoked on entity + * instances obtained from or managed by entity managers for this + * persistence unit or on new entity instances. + * + * @since Java Persistence 2.0 + */ +public interface PersistenceUnitUtil extends PersistenceUtil { + + /** + * Determine the load state of a given persistent attribute + * of an entity belonging to the persistence unit. + * @param entity entity instance containing the attribute + * @param attributeName name of attribute whose load state is + * to be determined + * @return false if entity's state has not been loaded or if + * the attribute state has not been loaded, else true + */ + public boolean isLoaded(Object entity, String attributeName); + + /** + * Determine the load state of an entity belonging to the + * persistence unit. This method can be used to determine the + * load state of an entity passed as a reference. An entity is + * considered loaded if all attributes for which + * FetchType.EAGER has been specified have been + * loaded. + *

The isLoaded(Object, String) method + * should be used to determine the load state of an attribute. + * Not doing so might lead to unintended loading of state. + * @param entity entity instance whose load state is to be determined + * @return false if the entity has not been loaded, else true + */ + public boolean isLoaded(Object entity); + + /** + * Return the id of the entity. + * A generated id is not guaranteed to be available until after + * the database insert has occurred. + * Returns null if the entity does not yet have an id. + * @param entity entity instance + * @return id of the entity + * @throws IllegalArgumentException if the object is found not + * to be an entity + */ + public Object getIdentifier(Object entity); +} Index: 3rdParty_sources/persistence-api/javax/persistence/PersistenceUnits.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PersistenceUnits.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PersistenceUnits.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,37 @@ +/******************************************************************************* + * 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 static java.lang.annotation.ElementType.*; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.*; + + +/** + * Declares one or more {@link PersistenceUnit} annotations. + * + * @since Java Persistence 1.0 + */ + +@Target({TYPE}) +@Retention(RUNTIME) +public @interface PersistenceUnits { + + /** (Required) One or more {@link PersistenceUnit} annotations. */ + PersistenceUnit[] value(); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/PersistenceUtil.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PersistenceUtil.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PersistenceUtil.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,54 @@ +/******************************************************************************* + * 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; + +/** + * Utility interface between the application and the persistence + * provider(s). + * + *

The PersistenceUtil interface instance obtained from the + * {@link Persistence} class is used to determine the load state of an + * entity or entity attribute regardless of which persistence + * provider in the environment created the entity. + * + * @since Java Persistence 2.0 + */ +public interface PersistenceUtil { + + /** + * Determine the load state of a given persistent attribute. + * @param entity entity containing the attribute + * @param attributeName name of attribute whose load state is + * to be determined + * @return false if entity's state has not been loaded or + * if the attribute state has not been loaded, else true + */ + public boolean isLoaded(Object entity, String attributeName); + + /** + * Determine the load state of an entity. + * This method can be used to determine the load state + * of an entity passed as a reference. An entity is + * considered loaded if all attributes for which + * FetchType.EAGER has been specified have been loaded. + *

The isLoaded(Object, String) method should be used to + * determine the load state of an attribute. + * Not doing so might lead to unintended loading of state. + * @param entity whose load state is to be determined + * @return false if the entity has not been loaded, else true + */ + public boolean isLoaded(Object entity); +} Index: 3rdParty_sources/persistence-api/javax/persistence/PessimisticLockException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PessimisticLockException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PessimisticLockException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,97 @@ +/******************************************************************************* + * 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; + +/** + * Thrown by the persistence provider when an pessimistic locking conflict + * occurs. This exception may be thrown as part of an API call, a flush or at + * commit time. The current transaction, if one is active, will be marked for + * rollback. + * + * @since Java Persistence 2.0 + */ +public class PessimisticLockException extends PersistenceException { + /** The object that caused the exception */ + Object entity; + + /** + * Constructs a new PessimisticLockException exception + * with null as its detail message. + */ + public PessimisticLockException() { + super(); + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified detail message. + * @param message the detail message. + */ + public PessimisticLockException(String message) { + super(message); + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified detail message and cause. + * @param message the detail message. + * @param cause the cause. + */ + public PessimisticLockException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified cause. + * @param cause the cause. + */ + public PessimisticLockException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified entity. + * @param entity the entity. + */ + public PessimisticLockException(Object entity) { + this.entity = entity; + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified detail message, cause, and entity. + * @param message the detail message. + * @param cause the cause. + * @param entity the entity. + */ + public PessimisticLockException(String message, Throwable cause, Object entity) { + super(message, cause); + this.entity = entity; + } + + /** + * Returns the entity that caused this exception. + * @return the entity. + */ + public Object getEntity() { + return this.entity; + } +} + + + Index: 3rdParty_sources/persistence-api/javax/persistence/PessimisticLockScope.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PessimisticLockScope.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PessimisticLockScope.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,64 @@ +/******************************************************************************* + * 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 values of the javax.persistence.lock.scope + * property for pessimistic locking. This property may be passed as + * an argument to the methods of the {@link EntityManager}, + * {@link Query}, and {@link TypedQuery} interfaces that + * allow lock modes to be specified or used with the + * {@link NamedQuery} annotation. + * + * @since Java Persistence 2.0 + */ +public enum PessimisticLockScope { + + /** + * This value defines the default behavior for pessimistic locking. + * + *

The persistence provider must lock the database row(s) that + * correspond to the non-collection-valued persistent state of + * that instance. If a joined inheritance strategy is used, or if + * the entity is otherwise mapped to a secondary table, this + * entails locking the row(s) for the entity instance in the + * additional table(s). Entity relationships for which the locked + * entity contains the foreign key will also be locked, but not + * the state of the referenced entities (unless those entities are + * explicitly locked). Element collections and relationships for + * which the entity does not contain the foreign key (such as + * relationships that are mapped to join tables or unidirectional + * one-to-many relationships for which the target entity contains + * the foreign key) will not be locked by default. + */ + NORMAL, + + /** + * In addition to the behavior for + * PessimisticLockScope.NORMAL, element collections + * and relationships owned by the entity that are contained in + * join tables will be locked if the + * javax.persistence.lock.scope property is specified + * with a value of PessimisticLockScope.EXTENDED. + * The state of entities referenced by such relationships will not + * be locked (unless those entities are explicitly locked). + * Locking such a relationship or element collection generally locks only + * the rows in the join table or collection table for that + * relationship or collection. This means that phantoms will be + * possible. + */ + EXTENDED +} Index: 3rdParty_sources/persistence-api/javax/persistence/PostLoad.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PostLoad.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PostLoad.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Specifies a callback method for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) + +public @interface PostLoad {} Index: 3rdParty_sources/persistence-api/javax/persistence/PostPersist.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PostPersist.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PostPersist.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Specifies a callback method for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) + +public @interface PostPersist {} Index: 3rdParty_sources/persistence-api/javax/persistence/PostRemove.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PostRemove.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PostRemove.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Specifies a callback method for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) + +public @interface PostRemove {} Index: 3rdParty_sources/persistence-api/javax/persistence/PostUpdate.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PostUpdate.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PostUpdate.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Specifies a callback method for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) + +public @interface PostUpdate {} Index: 3rdParty_sources/persistence-api/javax/persistence/PrePersist.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PrePersist.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PrePersist.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Specifies a callback method for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) + +public @interface PrePersist {} Index: 3rdParty_sources/persistence-api/javax/persistence/PreRemove.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PreRemove.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PreRemove.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Specifies a callback method for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) + +public @interface PreRemove {} Index: 3rdParty_sources/persistence-api/javax/persistence/PreUpdate.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PreUpdate.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PreUpdate.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Specifies a callback method for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) + +public @interface PreUpdate {} Index: 3rdParty_sources/persistence-api/javax/persistence/PrimaryKeyJoinColumn.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PrimaryKeyJoinColumn.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PrimaryKeyJoinColumn.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +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.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Specifies a primary key column that is used as a foreign key to + * join to another table. + * + *

It is used to join the primary table of an entity subclass + * in the {@link InheritanceType#JOINED JOINED} mapping strategy + * to the primary table of its superclass; it is used within a + * {@link SecondaryTable} annotation to join a secondary table + * to a primary table; and it may be used in a {@link OneToOne} + * mapping in which the primary key of the referencing entity + * is used as a foreign key to the referenced entity. + * + *

If no PrimaryKeyJoinColumn annotation is + * specified for a subclass in the JOINED + * mapping strategy, the foreign key columns are assumed + * to have the same names as the primary key columns of the + * primary table of the superclass. + * + *

+ *
+ *    Example: Customer and ValuedCustomer subclass
+ *
+ *    @Entity
+ *    @Table(name="CUST")
+ *    @Inheritance(strategy=JOINED)
+ *    @DiscriminatorValue("CUST")
+ *    public class Customer { ... }
+ *    
+ *    @Entity
+ *    @Table(name="VCUST")
+ *    @DiscriminatorValue("VCUST")
+ *    @PrimaryKeyJoinColumn(name="CUST_ID")
+ *    public class ValuedCustomer extends Customer { ... }
+ * 
+ * + * @see SecondaryTable + * @see Inheritance + * @see OneToOne + * @see ForeignKey + * + * @since Java Persistence 1.0 + */ +@Repeatable(PrimaryKeyJoinColumns.class) +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface PrimaryKeyJoinColumn { + + /** + * (Optional) The name of the primary key column of the current table. + *

Defaults to the same name as the primary key column + * of the primary table of the superclass (JOINED mapping strategy); the same + * name as the primary key column of the primary table + * (SecondaryTable mapping); or the same name as the + * primary key column for the table for the referencing entity + * (OneToOne mapping). + */ + String name() default ""; + + /** + * (Optional) The name of the primary key column of the table + * being joined to.

Defaults to the same name as the primary + * key column of the primary table of the superclass + * (JOINED mapping strategy); the same name as the + * primary key column of the primary table + * (SecondaryTable mapping); or the same name as the + * primary key column for the table for the referencing entity + * (OneToOne mapping). + */ + String referencedColumnName() default ""; + + /** + * (Optional) The SQL fragment that is used when generating the + * DDL for the column. This should not be specified for a + * OneToOne primary key association. + *

Defaults to the generated SQL to create a column of the + * inferred type. + */ + String columnDefinition() default ""; + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint for the primary key join column + * when table generation is in effect. If + * this element is not specified, the persistence provider's + * default foreign key strategy will apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); +} Index: 3rdParty_sources/persistence-api/javax/persistence/PrimaryKeyJoinColumns.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/PrimaryKeyJoinColumns.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/PrimaryKeyJoinColumns.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,70 @@ +/******************************************************************************* + * 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.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Groups {@link PrimaryKeyJoinColumn} annotations. + * It is used to map composite foreign keys. + * + *

+ *    Example: 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 { ... }
+ * 
+ * + * @see ForeignKey + * + * @since Java Persistence 1.0 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface PrimaryKeyJoinColumns { + + /** One or more PrimaryKeyJoinColumn annotations. */ + PrimaryKeyJoinColumn[] value(); + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint when table generation is in effect. + * If both this element and the foreignKey element + * of any of the PrimaryKeyJoinColumn elements are specified, + * the behavior is undefined. If no foreign key annotation element + * is specified in either location, the persistence provider's + * default foreign key strategy will apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/Query.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Query.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Query.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,488 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2017 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: + * Lukas Jungmann - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Set; +import java.util.Map; +import java.util.stream.Stream; + +/** + * Interface used to control query execution. + * + * @see TypedQuery + * @see StoredProcedureQuery + * @see Parameter + * + * @since Java Persistence 1.0 + */ +public interface Query { + + /** + * Execute a SELECT query and return the query results + * as an untyped List. + * @return a list of the results + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode other than + * NONE has been set and there is no transaction + * or the persistence context has not been joined to the transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + List getResultList(); + + /** + * Execute a SELECT query and return the query results + * as an untyped java.util.stream.Stream. + * By default this method delegates to getResultList().stream(), + * however persistence provider may choose to override this method + * to provide additional capabilities. + * + * @return a stream of the results + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode other than + * NONE has been set and there is no transaction + * or the persistence context has not been joined to the transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + * @see Stream + * @see #getResultList() + * @since 2.2 + */ + default Stream getResultStream() { + return getResultList().stream(); + } + + /** + * Execute a SELECT query that returns a single untyped result. + * @return the result + * @throws NoResultException if there is no result + * @throws NonUniqueResultException if more than one result + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode other than + * NONE has been set and there is no transaction + * or the persistence context has not been joined to the transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + Object getSingleResult(); + + /** + * Execute an update or delete statement. + * @return the number of entities updated or deleted + * @throws IllegalStateException if called for a Java + * Persistence query language SELECT statement or for + * a criteria query + * @throws TransactionRequiredException if there is + * no transaction or the persistence context has not + * been joined to the transaction + * @throws QueryTimeoutException if the statement execution + * exceeds the query timeout value set and only + * the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + int executeUpdate(); + + /** + * Set the maximum number of results to retrieve. + * @param maxResult maximum number of results to retrieve + * @return the same query instance + * @throws IllegalArgumentException if the argument is negative + */ + Query setMaxResults(int maxResult); + + /** + * The maximum number of results the query object was set to + * retrieve. Returns Integer.MAX_VALUE if setMaxResults was not + * applied to the query object. + * @return maximum number of results + * @since Java Persistence 2.0 + */ + int getMaxResults(); + + /** + * Set the position of the first result to retrieve. + * @param startPosition position of the first result, + * numbered from 0 + * @return the same query instance + * @throws IllegalArgumentException if the argument is negative + */ + Query setFirstResult(int startPosition); + + /** + * The position of the first result the query object was set to + * retrieve. Returns 0 if setFirstResult was not applied to the + * query object. + * @return position of the first result + * @since Java Persistence 2.0 + */ + int getFirstResult(); + + /** + * Set a query property or hint. The hints elements may be used + * to specify query properties and hints. Properties defined by + * this specification must be observed by the provider. + * Vendor-specific hints that are not recognized by a provider + * must be silently ignored. Portable applications should not + * rely on the standard timeout hint. Depending on the database + * in use and the locking mechanisms used by the provider, + * this hint may or may not be observed. + * @param hintName name of the property or hint + * @param value value for the property or hint + * @return the same query instance + * @throws IllegalArgumentException if the second argument is not + * valid for the implementation + */ + Query setHint(String hintName, Object value); + + /** + * Get the properties and hints and associated values that are + * in effect for the query instance. + * @return query properties and hints + * @since Java Persistence 2.0 + */ + Map getHints(); + + /** + * Bind the value of a Parameter object. + * @param param parameter object + * @param value parameter value + * @return the same query instance + * @throws IllegalArgumentException if the parameter + * does not correspond to a parameter of the + * query + * @since Java Persistence 2.0 + */ + Query setParameter(Parameter param, T value); + + /** + * Bind an instance of java.util.Calendar to a Parameter object. + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + * @since Java Persistence 2.0 + */ + Query setParameter(Parameter param, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a Parameter object. + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + * @since Java Persistence 2.0 + */ + Query setParameter(Parameter param, Date value, + TemporalType temporalType); + + /** + * Bind an argument value to a named parameter. + * @param name parameter name + * @param value parameter value + * @return the same query instance + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the argument is of incorrect type + */ + Query setParameter(String name, Object value); + + /** + * Bind an instance of java.util.Calendar to a named parameter. + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the value argument is of incorrect type + */ + Query setParameter(String name, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a named parameter. + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the value argument is of incorrect type + */ + Query setParameter(String name, Date value, + TemporalType temporalType); + + /** + * Bind an argument value to a positional parameter. + * @param position position + * @param value parameter value + * @return the same query instance + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the + * query or if the argument is of incorrect type + */ + Query setParameter(int position, Object value); + + /** + * Bind an instance of java.util.Calendar to a positional + * parameter. + * @param position position + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query or + * if the value argument is of incorrect type + */ + Query setParameter(int position, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a positional parameter. + * @param position position + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query or + * if the value argument is of incorrect type + */ + Query setParameter(int position, Date value, + TemporalType temporalType); + + /** + * Get the parameter objects corresponding to the declared + * parameters of the query. + * Returns empty set if the query has no parameters. + * This method is not required to be supported for native + * queries. + * @return set of the parameter objects + * @throws IllegalStateException if invoked on a native + * query when the implementation does not support + * this use + * @since Java Persistence 2.0 + */ + Set> getParameters(); + + /** + * Get the parameter object corresponding to the declared + * parameter of the given name. + * This method is not required to be supported for native + * queries. + * @param name parameter name + * @return parameter object + * @throws IllegalArgumentException if the parameter of the + * specified name does not exist + * @throws IllegalStateException if invoked on a native + * query when the implementation does not support + * this use + * @since Java Persistence 2.0 + */ + Parameter getParameter(String name); + + /** + * Get the parameter object corresponding to the declared + * parameter of the given name and type. + * This method is required to be supported for criteria queries + * only. + * @param name parameter name + * @param type type + * @return parameter object + * @throws IllegalArgumentException if the parameter of the + * specified name does not exist or is not assignable + * to the type + * @throws IllegalStateException if invoked on a native + * query or Java Persistence query language query when + * the implementation does not support this use + * @since Java Persistence 2.0 + */ + Parameter getParameter(String name, Class type); + + /** + * Get the parameter object corresponding to the declared + * positional parameter with the given position. + * This method is not required to be supported for native + * queries. + * @param position position + * @return parameter object + * @throws IllegalArgumentException if the parameter with the + * specified position does not exist + * @throws IllegalStateException if invoked on a native + * query when the implementation does not support + * this use + * @since Java Persistence 2.0 + */ + Parameter getParameter(int position); + + /** + * Get the parameter object corresponding to the declared + * positional parameter with the given position and type. + * This method is not required to be supported by the provider. + * @param position position + * @param type type + * @return parameter object + * @throws IllegalArgumentException if the parameter with the + * specified position does not exist or is not assignable + * to the type + * @throws IllegalStateException if invoked on a native + * query or Java Persistence query language query when + * the implementation does not support this use + * @since Java Persistence 2.0 + */ + Parameter getParameter(int position, Class type); + + /** + * Return a boolean indicating whether a value has been bound + * to the parameter. + * @param param parameter object + * @return boolean indicating whether parameter has been bound + * @since Java Persistence 2.0 + */ + boolean isBound(Parameter param); + + /** + * Return the input value bound to the parameter. + * (Note that OUT parameters are unbound.) + * @param param parameter object + * @return parameter value + * @throws IllegalArgumentException if the parameter is not + * a parameter of the query + * @throws IllegalStateException if the parameter has not been + * been bound + * @since Java Persistence 2.0 + */ + T getParameterValue(Parameter param); + + /** + * Return the input value bound to the named parameter. + * (Note that OUT parameters are unbound.) + * @param name parameter name + * @return parameter value + * @throws IllegalStateException if the parameter has not been + * been bound + * @throws IllegalArgumentException if the parameter of the + * specified name does not exist + * @since Java Persistence 2.0 + */ + Object getParameterValue(String name); + + /** + * Return the input value bound to the positional parameter. + * (Note that OUT parameters are unbound.) + * @param position position + * @return parameter value + * @throws IllegalStateException if the parameter has not been + * been bound + * @throws IllegalArgumentException if the parameter with the + * specified position does not exist + * @since Java Persistence 2.0 + */ + Object getParameterValue(int position); + + /** + * Set the flush mode type to be used for the query execution. + * The flush mode type applies to the query regardless of the + * flush mode type in use for the entity manager. + * @param flushMode flush mode + * @return the same query instance + */ + Query setFlushMode(FlushModeType flushMode); + + /** + * Get the flush mode in effect for the query execution. + * If a flush mode has not been set for the query object, + * returns the flush mode in effect for the entity manager. + * @return flush mode + * @since Java Persistence 2.0 + */ + FlushModeType getFlushMode(); + + /** + * Set the lock mode type to be used for the query execution. + * @param lockMode lock mode + * @return the same query instance + * @throws IllegalStateException if the query is found not to be + * a Java Persistence query language SELECT query + * or a CriteriaQuery query + * @since Java Persistence 2.0 + */ + Query setLockMode(LockModeType lockMode); + + /** + * Get the current lock mode for the query. Returns null if a lock + * mode has not been set on the query object. + * @return lock mode + * @throws IllegalStateException if the query is found not to be + * a Java Persistence query language SELECT query or + * a Criteria API query + * @since Java Persistence 2.0 + */ + LockModeType getLockMode(); + + /** + * Return an object of the specified type to allow access to + * the provider-specific API. If the provider's query + * implementation does not support the specified class, the + * PersistenceException is thrown. + * @param cls the class of the object to be returned. This is + * normally either the underlying query + * implementation class or an interface that it + * implements. + * @return an instance of the specified class + * @throws PersistenceException if the provider does not support + * the call + * @since Java Persistence 2.0 + */ + T unwrap(Class cls); +} Index: 3rdParty_sources/persistence-api/javax/persistence/QueryHint.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/QueryHint.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/QueryHint.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,39 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Used to supply a query property or hint to the {@link NamedQuery} or {@link + * NamedNativeQuery} annotation. + * + *

Vendor-specific hints that are not recognized by a provider are ignored. + * + * @since Java Persistence 1.0 + */ +@Target({}) +@Retention(RUNTIME) +public @interface QueryHint { + + /** Name of the hint. */ + String name(); + + /** Value of the hint. */ + String value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/QueryTimeoutException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/QueryTimeoutException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/QueryTimeoutException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,98 @@ +/******************************************************************************* + * 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; + +/** + * Thrown by the persistence provider when a query times out + * and only the statement is rolled back. + * The current transaction, if one is active, will be not + * be marked for rollback. + * + * @since Java Persistence 2.0 + */ +public class QueryTimeoutException extends PersistenceException { + + /** The query object that caused the exception */ + Query query; + + /** + * Constructs a new QueryTimeoutException exception + * with null as its detail message. + */ + public QueryTimeoutException() { + super(); + } + + /** + * Constructs a new QueryTimeoutException exception + * with the specified detail message. + * @param message the detail message. + */ + public QueryTimeoutException(String message) { + super(message); + } + + /** + * Constructs a new QueryTimeoutException exception + * with the specified detail message and cause. + * @param message the detail message. + * @param cause the cause. + */ + public QueryTimeoutException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new QueryTimeoutException exception + * with the specified cause. + * @param cause the cause. + */ + public QueryTimeoutException(Throwable cause) { + super(cause); + } + + + /** + * Constructs a new QueryTimeoutException exception + * with the specified query. + * @param query the query. + */ + public QueryTimeoutException(Query query) { + this.query = query; + } + + /** + * Constructs a new QueryTimeoutException exception + * with the specified detail message, cause, and query. + * @param message the detail message. + * @param cause the cause. + * @param query the query. + */ + public QueryTimeoutException(String message, Throwable cause, Query query) { + super(message, cause); + this.query = query; + } + + /** + * Returns the query that caused this exception. + * @return the query. + */ + public Query getQuery() { + return this.query; + } +} + + Index: 3rdParty_sources/persistence-api/javax/persistence/RollbackException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/RollbackException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/RollbackException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,64 @@ +/******************************************************************************* + * 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; +/** + * Thrown by the persistence provider when + * {@link EntityTransaction#commit() EntityTransaction.commit()} fails. + * + * @see javax.persistence.EntityTransaction#commit() + * + * @since Java Persistence 1.0 + */ +public class RollbackException extends PersistenceException { + + /** + * Constructs a new RollbackException exception + * with null as its detail message. + */ + public RollbackException() { + super(); + } + + /** + * Constructs a new RollbackException exception + * with the specified detail message. + * @param message the detail message. + */ + public RollbackException(String message) { + super(message); + } + + /** + * Constructs a new RollbackException exception + * with the specified detail message and cause. + * @param message the detail message. + * @param cause the cause. + */ + public RollbackException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new RollbackException exception + * with the specified cause. + * @param cause the cause. + */ + public RollbackException(Throwable cause) { + super(cause); + } +} + + Index: 3rdParty_sources/persistence-api/javax/persistence/SecondaryTable.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/SecondaryTable.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/SecondaryTable.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; + +/** + * Specifies a secondary table for the annotated entity + * class. Specifying one or more secondary tables indicates that the + * data for the entity class is stored across multiple tables. + * + *

If no SecondaryTable annotation is specified, + * it is assumed that all persistent fields or properties of the + * entity are mapped to the primary table. If no primary key join + * columns are specified, the join columns are assumed to reference + * the primary key columns of the primary table, and have the same + * names and types as the referenced primary key columns of the + * primary table. + * + *

+ *    Example 1: Single secondary table with a single primary key column.
+ *
+ *    @Entity
+ *    @Table(name="CUSTOMER")
+ *    @SecondaryTable(name="CUST_DETAIL", 
+ *        pkJoinColumns=@PrimaryKeyJoinColumn(name="CUST_ID"))
+ *    public class Customer { ... } 
+ *
+ *
+ *    Example 2: Single secondary table with multiple primary key columns.
+ *
+ *    @Entity
+ *    @Table(name="CUSTOMER")
+ *    @SecondaryTable(name="CUST_DETAIL",
+ *        pkJoinColumns={
+ *            @PrimaryKeyJoinColumn(name="CUST_ID"),
+ *            @PrimaryKeyJoinColumn(name="CUST_TYPE")})
+ *    public class Customer { ... }
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Repeatable(SecondaryTables.class) +@Target(TYPE) +@Retention(RUNTIME) + +public @interface SecondaryTable { + + /** (Required) The name of the table. */ + String name(); + + /** (Optional) The catalog of the table. + *

Defaults to the default catalog. + */ + String catalog() default ""; + + /** (Optional) The schema of the table. + *

Defaults to the default schema for user. + */ + String schema() default ""; + + /** + * (Optional) The columns that are used to join with + * the primary table. + *

Defaults to the column(s) of the same name(s) + * as the primary key column(s) in the primary table. + */ + PrimaryKeyJoinColumn[] pkJoinColumns() default {}; + + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint for the columns corresponding to the + * pkJoinColumns element when table generation is + * in effect. If both this element and the + * foreignKey element of any of the + * pkJoinColumns elements are specified, the + * behavior is undefined. If no foreign key annotation element + * is specified in either location, the persistence provider's + * default foreign key strategy will apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); + + /** + * (Optional) Unique constraints that are to be placed on the + * table. These are typically only used if table generation + * is in effect. These constraints apply in addition to any + * constraints specified by the Column and JoinColumn + * annotations and constraints entailed by primary key mappings. + *

Defaults to no additional constraints. + */ + UniqueConstraint[] uniqueConstraints() default {}; + + /** + * (Optional) Indexes for the table. These are only used if + * table generation is in effect. + * + * @since Java Persistence 2.1 + */ + Index[] indexes() default {}; +} Index: 3rdParty_sources/persistence-api/javax/persistence/SecondaryTables.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/SecondaryTables.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/SecondaryTables.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,60 @@ +/******************************************************************************* + * 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 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 + */ +@Target(TYPE) +@Retention(RUNTIME) + +public @interface SecondaryTables { + + /** (Required) The secondary tables for an entity. */ + SecondaryTable[] value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/SequenceGenerator.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/SequenceGenerator.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/SequenceGenerator.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2017 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: + * Lukas Jungmann - Java Persistence 2.2 + * 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.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Repeatable; + +/** + * Defines a primary key generator that may be referenced by name when + * a generator element is specified for the {@link GeneratedValue} + * annotation. A sequence generator may be specified on the entity + * class or on the primary key field or property. The scope of the + * generator name is global to the persistence unit (across all + * generator types). + * + *
+ *   Example:
+ *
+ *   @SequenceGenerator(name="EMP_SEQ", allocationSize=25)
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Repeatable(SequenceGenerators.class) +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) +public @interface SequenceGenerator { + + /** + * (Required) A unique generator name that can be referenced + * by one or more classes to be the generator for primary key + * values. + */ + String name(); + + /** + * (Optional) The name of the database sequence object from + * which to obtain primary key values. + *

Defaults to a provider-chosen value. + */ + String sequenceName() default ""; + + /** (Optional) The catalog of the sequence generator. + * + * @since Java Persistence 2.0 + */ + String catalog() default ""; + + /** (Optional) The schema of the sequence generator. + * + * @since Java Persistence 2.0 + */ + String schema() default ""; + + /** + * (Optional) The value from which the sequence object + * is to start generating. + */ + int initialValue() default 1; + + /** + * (Optional) The amount to increment by when allocating + * sequence numbers from the sequence. + */ + int allocationSize() default 50; +} Index: 3rdParty_sources/persistence-api/javax/persistence/SequenceGenerators.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/SequenceGenerators.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/SequenceGenerators.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2017 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: + * Lukas Jungmann - Java Persistence 2.2 + * + ******************************************************************************/ +package javax.persistence; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Used to group SequenceGenerator annotations. + * + * @see SequenceGenerator + * @since Java Persistence 2.2 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) +public @interface SequenceGenerators { + + SequenceGenerator[] value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/SharedCacheMode.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/SharedCacheMode.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/SharedCacheMode.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2014 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; + +/** + * Specifies how the provider must use a second-level cache for the + * persistence unit. Corresponds to the value of the persistence.xml + * shared-cache-mode element, and returned as the result of + * {@link javax.persistence.spi.PersistenceUnitInfo#getSharedCacheMode()}. + * + * @since Java Persistence 2.0 + */ +public enum SharedCacheMode { + + /** + * All entities and entity-related state and data are cached. + */ + ALL, + + /** + * Caching is disabled for the persistence unit. + */ + NONE, + + /** + * Caching is enabled for all entities for Cacheable(true) + * is specified. All other entities are not cached. + */ + ENABLE_SELECTIVE, + + /** + * Caching is enabled for all entities except those for which + * Cacheable(false) is specified. Entities for which + * Cacheable(false) is specified are not cached. + */ + DISABLE_SELECTIVE, + + /** + * + * Caching behavior is undefined: provider-specific defaults may apply. + */ + UNSPECIFIED +} Index: 3rdParty_sources/persistence-api/javax/persistence/SqlResultSetMapping.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/SqlResultSetMapping.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/SqlResultSetMapping.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2015 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: + * Petros Splinakis - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Repeatable; +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 mapping of the result of a native SQL query or stored + * procedure. + * + *

+ *    Example:
+ *
+ *    Query q = em.createNativeQuery(
+ *        "SELECT o.id AS order_id, " +
+ *            "o.quantity AS order_quantity, " +
+ *            "o.item AS order_item, " +
+ *            "i.name AS item_name, " +
+ *        "FROM Order o, Item i " +
+ *        "WHERE (order_quantity > 25) AND (order_item = i.id)",
+ *    "OrderResults");
+ *    
+ *    @SqlResultSetMapping(name="OrderResults", 
+ *        entities={ 
+ *            @EntityResult(entityClass=com.acme.Order.class, fields={
+ *                @FieldResult(name="id", column="order_id"),
+ *                @FieldResult(name="quantity", column="order_quantity"), 
+ *                @FieldResult(name="item", column="order_item")})},
+ *        columns={
+ *            @ColumnResult(name="item_name")}
+ *    )
+ * 
+ * + * @see Query + * @see StoredProcedureQuery + * @see NamedNativeQuery + * @see NamedStoredProcedureQuery + * + * @since Java Persistence 1.0 + */ +@Repeatable(SqlResultSetMappings.class) +@Target({TYPE}) +@Retention(RUNTIME) +public @interface SqlResultSetMapping { + + /** + * The name given to the result set mapping, and used to refer + * to it in the methods of the {@link Query} and + * {@link StoredProcedureQuery} APIs. + */ + String name(); + + /** Specifies the result set mapping to entities. */ + EntityResult[] entities() default {}; + + /** + * Specifies the result set mapping to constructors. + * @since Java Persistence 2.1 + */ + ConstructorResult[] classes() default {}; + + /** Specifies the result set mapping to scalar values. */ + ColumnResult[] columns() default {}; +} Index: 3rdParty_sources/persistence-api/javax/persistence/SqlResultSetMappings.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/SqlResultSetMappings.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/SqlResultSetMappings.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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; + +/** + * Is used to define one or more {@link SqlResultSetMapping} annotations. + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface SqlResultSetMappings { + + /** One or more SqlResultSetMapping annotations. */ + SqlResultSetMapping[] value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/StoredProcedureParameter.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/StoredProcedureParameter.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/StoredProcedureParameter.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ +package javax.persistence; + +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a parameter of a named stored procedure query. All + * parameters of a named stored procedure query must be specified. + * + * @see NamedStoredProcedureQuery + * @see ParameterMode + * + * @since Java Persistence 2.1 + */ +@Target({}) +@Retention(RUNTIME) +public @interface StoredProcedureParameter { + + /** + * The name of the parameter as defined by the stored procedure in the database. + * If a name is not specified, it is assumed that the stored procedure uses + * positional parameters. + */ + String name() default ""; + + /** + * Specifies whether the parameter is an IN, INOUT, OUT, or REF_CURSOR parameter. + * REF_CURSOR parameters are used by some databases to return result sets from + * a stored procedure. + */ + ParameterMode mode() default ParameterMode.IN; + + /** JDBC type of the paramter. */ + Class type(); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/StoredProcedureQuery.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/StoredProcedureQuery.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/StoredProcedureQuery.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,397 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2017 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 + * + ******************************************************************************/ +package javax.persistence; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +/** + * Interface used to control stored procedure query execution. + * + *

+ * Stored procedure query execution may be controlled in accordance with + * the following: + *

    + *
  • The setParameter methods are used to set the values of + * all required IN and INOUT parameters. + * It is not required to set the values of stored procedure parameters + * for which default values have been defined by the stored procedure.
  • + *
  • + * When getResultList and getSingleResult are + * called on a StoredProcedureQuery object, the provider + * will call execute on an unexecuted stored procedure + * query before processing getResultList or + * getSingleResult.
  • + *
  • + * When executeUpdate is called on a + * StoredProcedureQuery object, the provider will call + * execute on an unexecuted stored procedure query + * followed by getUpdateCount. The results of + * executeUpdate will be those of getUpdateCount.
  • + *
  • + * The execute method supports both the simple case where + * scalar results are passed back only via INOUT and + * OUT parameters as well as the most general case + * (multiple result sets and/or update counts, possibly also in + * combination with output parameter values).
  • + *
  • + * The execute method returns true if the first result is a + * result set, and false if it is an update count or there are no results + * other than through INOUT and OUT parameters, + * if any.
  • + *
  • + * If the execute method returns true, the pending result set + * can be obtained by calling getResultList or + * getSingleResult.
  • + *
  • + * The hasMoreResults method can then be used to test + * for further results.
  • + *
  • + * If execute or hasMoreResults returns false, + * the getUpdateCount method can be called to obtain the + * pending result if it is an update count. The getUpdateCount + * method will return either the update count (zero or greater) or -1 + * if there is no update count (i.e., either the next result is a result set + * or there is no next update count).
  • + *
  • + * For portability, results that correspond to JDBC result sets and + * update counts need to be processed before the values of any + * INOUT or OUT parameters are extracted.
  • + *
  • + * After results returned through getResultList and + * getUpdateCount have been exhausted, results returned through + * INOUT and OUT parameters can be retrieved.
  • + *
  • + * The getOutputParameterValue methods are used to retrieve + * the values passed back from the procedure through INOUT + * and OUT parameters.
  • + *
  • + * When using REF_CURSOR parameters for result sets the + * update counts should be exhausted before calling getResultList + * to retrieve the result set. Alternatively, the REF_CURSOR + * result set can be retrieved through getOutputParameterValue. + * Result set mappings will be applied to results corresponding to + * REF_CURSOR parameters in the order the REF_CURSOR + * parameters were registered with the query.
  • + *
  • + * In the simplest case, where results are returned only via + * INOUT and OUT parameters, execute + * can be followed immediately by calls to + * getOutputParameterValue.
  • + *
+ * + * @see Query + * @see Parameter + * + * @since Java Persistence 2.1 + */ +public interface StoredProcedureQuery extends Query { + + /** + * Set a query property or hint. The hints elements may be used + * to specify query properties and hints. Properties defined by + * this specification must be observed by the provider. + * Vendor-specific hints that are not recognized by a provider + * must be silently ignored. Portable applications should not + * rely on the standard timeout hint. Depending on the database + * in use, this hint may or may not be observed. + * @param hintName name of the property or hint + * @param value value for the property or hint + * @return the same query instance + * @throws IllegalArgumentException if the second argument is not + * valid for the implementation + */ + StoredProcedureQuery setHint(String hintName, Object value); + + /** + * Bind the value of a Parameter object. + * @param param parameter object + * @param value parameter value + * @return the same query instance + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + StoredProcedureQuery setParameter(Parameter param, + T value); + + /** + * Bind an instance of java.util.Calendar to a Parameter object. + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + StoredProcedureQuery setParameter(Parameter param, + Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a Parameter object. + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + StoredProcedureQuery setParameter(Parameter param, + Date value, + TemporalType temporalType); + + /** + * Bind an argument value to a named parameter. + * @param name parameter name + * @param value parameter value + * @return the same query instance + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if the + * argument is of incorrect type + */ + StoredProcedureQuery setParameter(String name, Object value); + + /** + * Bind an instance of java.util.Calendar to a named parameter. + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if the + * value argument is of incorrect type + */ + StoredProcedureQuery setParameter(String name, + Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a named parameter. + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if the + * value argument is of incorrect type + */ + StoredProcedureQuery setParameter(String name, + Date value, + TemporalType temporalType); + + /** + * Bind an argument value to a positional parameter. + * @param position position + * @param value parameter value + * @return the same query instance + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query + * or if the argument is of incorrect type + */ + StoredProcedureQuery setParameter(int position, Object value); + + /** + * Bind an instance of java.util.Calendar to a positional + * parameter. + * @param position position + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query or + * if the value argument is of incorrect type + */ + StoredProcedureQuery setParameter(int position, + Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a positional parameter. + * @param position position + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query or + * if the value argument is of incorrect type + */ + StoredProcedureQuery setParameter(int position, + Date value, + TemporalType temporalType); + + /** + * Set the flush mode type to be used for the query execution. + * The flush mode type applies to the query regardless of the + * flush mode type in use for the entity manager. + * @param flushMode flush mode + * @return the same query instance + */ + StoredProcedureQuery setFlushMode(FlushModeType flushMode); + + /** + * Register a positional parameter. + * All parameters must be registered. + * @param position parameter position + * @param type type of the parameter + * @param mode parameter mode + * @return the same query instance + */ + StoredProcedureQuery registerStoredProcedureParameter( + int position, + Class type, + ParameterMode mode); + + /** + * Register a named parameter. + * @param parameterName name of the parameter as registered or + * specified in metadata + * @param type type of the parameter + * @param mode parameter mode + * @return the same query instance + */ + StoredProcedureQuery registerStoredProcedureParameter( + String parameterName, + Class type, + ParameterMode mode); + + /** + * Retrieve a value passed back from the procedure + * through an INOUT or OUT parameter. + * For portability, all results corresponding to result sets + * and update counts must be retrieved before the values of + * output parameters. + * @param position parameter position + * @return the result that is passed back through the parameter + * @throws IllegalArgumentException if the position does + * not correspond to a parameter of the query or is + * not an INOUT or OUT parameter + */ + Object getOutputParameterValue(int position); + + /** + * Retrieve a value passed back from the procedure + * through an INOUT or OUT parameter. + * For portability, all results corresponding to result sets + * and update counts must be retrieved before the values of + * output parameters. + * @param parameterName name of the parameter as registered or + * specified in metadata + * @return the result that is passed back through the parameter + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or is + * not an INOUT or OUT parameter + */ + Object getOutputParameterValue(String parameterName); + + /** + * Return true if the first result corresponds to a result set, + * and false if it is an update count or if there are no results + * other than through INOUT and OUT parameters, if any. + * @return true if first result corresponds to result set + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + boolean execute(); + + /** + * Return the update count of -1 if there is no pending result or + * if the first result is not an update count. The provider will + * call execute on the query if needed. + * @return the update count or -1 if there is no pending result + * or if the next result is not an update count. + * @throws TransactionRequiredException if there is + * no transaction or the persistence context has not + * been joined to the transaction + * @throws QueryTimeoutException if the statement execution + * exceeds the query timeout value set and only + * the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + int executeUpdate(); + + /** + * Retrieve the list of results from the next result set. + * The provider will call execute on the query + * if needed. + * A REF_CURSOR result set, if any, will be retrieved + * in the order the REF_CURSOR parameter was + * registered with the query. + * @return a list of the results or null is the next item is not + * a result set + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + List getResultList(); + + /** + * Retrieve a single result from the next result set. + * The provider will call execute on the query + * if needed. + * A REF_CURSOR result set, if any, will be retrieved + * in the order the REF_CURSOR parameter was + * registered with the query. + * @return the result or null if the next item is not a result set + * @throws NoResultException if there is no result in the next + * result set + * @throws NonUniqueResultException if more than one result + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + Object getSingleResult(); + + /** + * Return true if the next result corresponds to a result set, + * and false if it is an update count or if there are no results + * other than through INOUT and OUT parameters, if any. + * @return true if next result corresponds to result set + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + boolean hasMoreResults(); + + /** + * Return the update count or -1 if there is no pending result + * or if the next result is not an update count. + * @return update count or -1 if there is no pending result or if + * the next result is not an update count + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + int getUpdateCount(); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/Subgraph.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Subgraph.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Subgraph.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,201 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ + +package javax.persistence; + +import javax.persistence.metamodel.Attribute; +import java.util.List; + +/** + * This type represents a subgraph for an attribute node that + * corresponds to a Managed Type. Using this class, an entity subgraph + * can be embedded within an EntityGraph. + * + * @param The type of the attribute. + * + * @see EntityGraph + * @see AttributeNode + * @see NamedSubgraph + * + * @since Java Persistence 2.1 + */ +public interface Subgraph { + + /** + * Add one or more attribute nodes to the entity graph. + * + * @param attributeName name of the attribute + * @throws IllegalArgumentException if the attribute is not an + * attribute of this managed type. + * @throws IllegalStateException if the EntityGraph has been + * statically defined + */ + public void addAttributeNodes(String ... attributeName); + + /** + * Add one or more attribute nodes to the entity graph. + * @param attribute attribute + * + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public void addAttributeNodes(Attribute ... attribute); + + /** + * Add a node to the graph that corresponds to a managed + * type. This allows for construction of multi-node entity graphs + * that include related managed types. + * + * @param attribute attribute + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute's target + * type is not a managed type + * @throws IllegalStateException if the EntityGraph has been + * statically defined + */ + public Subgraph addSubgraph(Attribute attribute); + + /** + * Add a node to the graph that corresponds to a managed + * type with inheritance. This allows for multiple subclass + * subgraphs to be defined for this node of the entity + * graph. Subclass subgraphs will automatically include the specified + * attributes of superclass subgraphs + * + * @param attribute attribute + * @param type entity subclass + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute's target + * type is not a managed type + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addSubgraph(Attribute attribute, Class type); + + /** + * Add a node to the graph that corresponds to a managed + * type. This allows for construction of multi-node entity graphs + * that include related managed types. + * + * @param attributeName name of the attribute + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute is not an + * attribute of this managed type. + * @throws IllegalArgumentException if the attribute's target + * type is not a managed type + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addSubgraph(String attributeName); + + /** + * Add a node to the graph that corresponds to a managed + * type with inheritance. This allows for multiple subclass + * subgraphs to be defined for this node of the entity + * graph. Subclass subgraphs will automatically include the + * specified attributes of superclass subgraphs + * + * @param attributeName name of the attribute + * @param type entity subclass + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute is not + * an attribute of this managed type. + * @throws IllegalArgumentException if the attribute's target + * type is not a managed type + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addSubgraph(String attributeName, Class type); + + /** + * Add a node to the graph that corresponds to a map key + * that is a managed type. This allows for construction of + * multinode entity graphs that include related managed types. + * + * @param attribute attribute + * @return subgraph for the key attribute + * @throws IllegalArgumentException if the attribute's target + * type is not a managed type entity + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addKeySubgraph(Attribute attribute); + + /** + * Add a node to the graph that corresponds to a map key + * that is a managed type with inheritance. This allows for + * construction of multi-node entity graphs that include related + * managed types. Subclass subgraphs will automatically include + * the specified attributes of superclass subgraphs + * + * @param attribute attribute + * @param type entity subclass + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute's target + * type is not a managed type entity + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addKeySubgraph(Attribute attribute, Class type); + + /** + * Add a node to the graph that corresponds to a map key + * that is a managed type. This allows for construction of + * multi-node entity graphs that include related managed types. + * + * @param attributeName name of the attribute + * @return subgraph for the key attribute + * @throws IllegalArgumentException if the attribute is not an + * attribute of this entity. + * @throws IllegalArgumentException if the attribute's target + * type is not a managed type + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addKeySubgraph(String attributeName); + + /** + * Add a node to the graph that corresponds to a map key + * that is a managed type with inheritance. This allows for + * construction of multi-node entity graphs that include related + * managed types. Subclass subgraphs will include the specified + * attributes of superclass subgraphs + * + * @param attributeName name of the attribute + * @param type entity subclass + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute is not an + * attribute of this entity. + * @throws IllegalArgumentException if the attribute's target + * type is not a managed type + * @throws IllegalStateException if this EntityGraph has been + * statically defined + */ + public Subgraph addKeySubgraph(String attributeName, Class type); + + /** + * Return the attribute nodes corresponding to the attributes of + * this managed type that are included in the subgraph. + * @return list of attribute nodes included in the subgraph or + * empty List if none have been defined + */ + public List> getAttributeNodes(); + + /** + * Return the type for which this subgraph was defined. + * @return managed type referenced by the subgraph + */ + public Class getClassType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/SynchronizationType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/SynchronizationType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/SynchronizationType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ +package javax.persistence; + +/** + * Specifies whether the persistence context is always automatically + * synchronized with the current transaction or whether the persistence context + * must be explicitly joined to the current transaction by means of the + * {@link EntityManager#joinTransaction} method. + * + * @since Java Persistence 2.1 + */ +public enum SynchronizationType { + + /** Persistence context is automatically synchronized with the current transaction */ + SYNCHRONIZED, + + /** Persistence context must be explicitly joined to the current transaction */ + UNSYNCHRONIZED, +} Index: 3rdParty_sources/persistence-api/javax/persistence/Table.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Table.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Table.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,80 @@ +/******************************************************************************* + * 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 {@link SecondaryTable} or {@link + * SecondaryTables} annotation. + * + *

If no Table annotation is specified for an entity + * class, the default values apply. + * + *

+ *    Example:
+ *
+ *    @Entity
+ *    @Table(name="CUST", schema="RECORDS")
+ *    public class Customer { ... }
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface Table { + + /** + * (Optional) The name of the table. + *

Defaults to the entity name. + */ + String name() default ""; + + /** (Optional) The catalog of the table. + *

Defaults to the default catalog. + */ + String catalog() default ""; + + /** (Optional) The schema of the table. + *

Defaults to the default schema for user. + */ + String schema() default ""; + + /** + * (Optional) Unique constraints that are to be placed on + * the table. These are only used if table generation is in + * effect. These constraints apply in addition to any constraints + * specified by the Column and JoinColumn + * annotations and constraints entailed by primary key mappings. + *

Defaults to no additional constraints. + */ + UniqueConstraint[] uniqueConstraints() default {}; + + /** + * (Optional) Indexes for the table. These are only used if + * table generation is in effect. Note that it is not necessary + * to specify an index for a primary key, as the primary key + * index will be created automatically. + * + * @since Java Persistence 2.1 + */ + Index[] indexes() default {}; +} Index: 3rdParty_sources/persistence-api/javax/persistence/TableGenerator.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/TableGenerator.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/TableGenerator.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,152 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2017 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: + * Lukas Jungmann - Java Persistence 2.2 + * 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.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Repeatable; + +/** + * Defines a primary key generator that may be + * referenced by name when a generator element is specified for + * the {@link GeneratedValue} annotation. A table generator + * may be specified on the entity class or on the primary key + * field or property. The scope of the generator name is global + * to the persistence unit (across all generator types). + * + *

+ *    Example 1:
+ *    
+ *    @Entity public class Employee {
+ *        ...
+ *        @TableGenerator(
+ *            name="empGen", 
+ *            table="ID_GEN", 
+ *            pkColumnName="GEN_KEY", 
+ *            valueColumnName="GEN_VALUE", 
+ *            pkColumnValue="EMP_ID", 
+ *            allocationSize=1)
+ *        @Id
+ *        @GeneratedValue(strategy=TABLE, generator="empGen")
+ *        int id;
+ *        ...
+ *    }
+ *    
+ *    Example 2:
+ *    
+ *    @Entity public class Address {
+ *        ...
+ *        @TableGenerator(
+ *            name="addressGen", 
+ *            table="ID_GEN", 
+ *            pkColumnName="GEN_KEY", 
+ *            valueColumnName="GEN_VALUE", 
+ *            pkColumnValue="ADDR_ID")
+ *        @Id
+ *        @GeneratedValue(strategy=TABLE, generator="addressGen")
+ *        int id;
+ *        ...
+ *    }
+ * 
+ * + * @see GeneratedValue + * + * @since Java Persistence 1.0 + */ +@Repeatable(TableGenerators.class) +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) +public @interface TableGenerator { + + /** + * (Required) A unique generator name that can be referenced + * by one or more classes to be the generator for id values. + */ + String name(); + + /** + * (Optional) Name of table that stores the generated id values. + *

Defaults to a name chosen by persistence provider. + */ + String table() default ""; + + /** (Optional) The catalog of the table. + *

Defaults to the default catalog. + */ + String catalog() default ""; + + /** (Optional) The schema of the table. + *

Defaults to the default schema for user. + */ + String schema() default ""; + + /** + * (Optional) Name of the primary key column in the table. + *

Defaults to a provider-chosen name. + */ + String pkColumnName() default ""; + + /** + * (Optional) Name of the column that stores the last value generated. + *

Defaults to a provider-chosen name. + */ + String valueColumnName() default ""; + + /** + * (Optional) The primary key value in the generator table + * that distinguishes this set of generated values from others + * that may be stored in the table. + *

Defaults to a provider-chosen value to store in the + * primary key column of the generator table + */ + String pkColumnValue() default ""; + + /** + * (Optional) The initial value to be used to initialize the column + * that stores the last value generated. + */ + int initialValue() default 0; + + /** + * (Optional) The amount to increment by when allocating id + * numbers from the generator. + */ + int allocationSize() default 50; + + /** + * (Optional) Unique constraints that are to be placed on the + * table. These are only used if table generation is in effect. + * These constraints apply in addition to primary key constraints. + *

Defaults to no additional constraints. + */ + UniqueConstraint[] uniqueConstraints() default {}; + + /** + * (Optional) Indexes for the table. These are only used if + * table generation is in effect. Note that it is not necessary + * to specify an index for a primary key, as the primary key + * index will be created automatically. + * + * @since Java Persistence 2.1 + */ + Index[] indexes() default {}; +} Index: 3rdParty_sources/persistence-api/javax/persistence/TableGenerators.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/TableGenerators.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/TableGenerators.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2017 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: + * Lukas Jungmann - Java Persistence 2.2 + * + ******************************************************************************/ +package javax.persistence; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Used to group TableGenerator annotations. + * + * @see TableGenerator + * @since Java Persistence 2.2 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) +public @interface TableGenerators { + + TableGenerator[] value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/Temporal.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Temporal.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Temporal.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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; + +/** + * This annotation must be specified for persistent fields + * or properties of type java.util.Date and + * java.util.Calendar. It may only be specified for fields + * or properties of these types. + * + *

The Temporal annotation may be used in + * conjunction with the {@link Basic} annotation, the {@link Id} + * annotation, or the {@link ElementCollection} annotation (when + * the element collection value is of such a temporal type. + * + *

+ *     Example:
+ * 
+ *     @Temporal(DATE)
+ *     protected java.util.Date endDate;
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Temporal { + + /** The type used in mapping java.util.Date or java.util.Calendar. */ + TemporalType value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/TemporalType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/TemporalType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/TemporalType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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; + +/** + * Type used to indicate a specific mapping of java.util.Date + * or java.util.Calendar. + * + * @since Java Persistence 1.0 + */ +public enum TemporalType { + + /** Map as java.sql.Date */ + DATE, + + /** Map as java.sql.Time */ + TIME, + + /** Map as java.sql.Timestamp */ + TIMESTAMP +} Index: 3rdParty_sources/persistence-api/javax/persistence/TransactionRequiredException.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/TransactionRequiredException.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/TransactionRequiredException.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,44 @@ +/******************************************************************************* + * 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; + +/** + * Thrown by the persistence provider when a transaction is required but is not + * active. + * + * @since Java Persistence 1.0 + */ +public class TransactionRequiredException extends PersistenceException { + + /** + * Constructs a new TransactionRequiredException exception with + * null as its detail message. + */ + public TransactionRequiredException() { + super(); + } + + /** + * Constructs a new TransactionRequiredException exception with + * the specified detail message. + * + * @param message + * the detail message. + */ + public TransactionRequiredException(String message) { + super(message); + } +} Index: 3rdParty_sources/persistence-api/javax/persistence/Transient.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Transient.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Transient.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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. + * + *
+ *    Example:
+ *
+ *    @Entity
+ *    public class Employee {
+ *        @Id int id;
+ *        @Transient User currentUser;
+ *        ...
+ *    }
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface Transient {} Index: 3rdParty_sources/persistence-api/javax/persistence/Tuple.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Tuple.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Tuple.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,96 @@ +/******************************************************************************* + * 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.util.List; + +/** + * Interface for extracting the elements of a query result tuple. + * + * @see TupleElement + * + * @since Java Persistence 2.0 + */ +public interface Tuple { + + /** + * Get the value of the specified tuple element. + * @param tupleElement tuple element + * @return value of tuple element + * @throws IllegalArgumentException if tuple element + * does not correspond to an element in the + * query result tuple + */ + X get(TupleElement tupleElement); + + /** + * Get the value of the tuple element to which the + * specified alias has been assigned. + * @param alias alias assigned to tuple element + * @param type of the tuple element + * @return value of the tuple element + * @throws IllegalArgumentException if alias + * does not correspond to an element in the + * query result tuple or element cannot be + * assigned to the specified type + */ + X get(String alias, Class type); + + /** + * Get the value of the tuple element to which the + * specified alias has been assigned. + * @param alias alias assigned to tuple element + * @return value of the tuple element + * @throws IllegalArgumentException if alias + * does not correspond to an element in the + * query result tuple + */ + Object get(String alias); + + /** + * Get the value of the element at the specified + * position in the result tuple. The first position is 0. + * @param i position in result tuple + * @param type type of the tuple element + * @return value of the tuple element + * @throws IllegalArgumentException if i exceeds + * length of result tuple or element cannot be + * assigned to the specified type + */ + X get(int i, Class type); + + /** + * Get the value of the element at the specified + * position in the result tuple. The first position is 0. + * @param i position in result tuple + * @return value of the tuple element + * @throws IllegalArgumentException if i exceeds + * length of result tuple + */ + Object get(int i); + + /** + * Return the values of the result tuple elements as an array. + * @return tuple element values + */ + Object[] toArray(); + + /** + * Return the tuple elements. + * @return tuple elements + */ + List> getElements(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/TupleElement.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/TupleElement.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/TupleElement.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,41 @@ +/******************************************************************************* + * 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; + +/** + * The TupleElement interface defines an element that is returned in + * a query result tuple. + * @param the type of the element + * + * @see Tuple + * + * @since Java Persistence 2.0 + */ +public interface TupleElement { + + /** + * Return the Java type of the tuple element. + * @return the Java type of the tuple element + */ + Class getJavaType(); + + /** + * Return the alias assigned to the tuple element or null, + * if no alias has been assigned. + * @return alias + */ + String getAlias(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/TypedQuery.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/TypedQuery.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/TypedQuery.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,277 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2017 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: + * Lukas Jungmann - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence; + +import java.util.List; +import java.util.Date; +import java.util.Calendar; +import java.util.stream.Stream; + +/** + * Interface used to control the execution of typed queries. + * @param query result type + * + * @see Query + * @see Parameter + * + * @since Java Persistence 2.0 + */ +public interface TypedQuery extends Query { + + /** + * Execute a SELECT query and return the query results + * as a typed List. + * @return a list of the results + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode other than + * NONE has been set and there is no transaction + * or the persistence context has not been joined to the + * transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + List getResultList(); + + /** + * Execute a SELECT query and return the query results + * as a typed java.util.stream.Stream. + * By default this method delegates to getResultList().stream(), + * however persistence provider may choose to override this method + * to provide additional capabilities. + * + * @return a stream of the results + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode other than + * NONE has been set and there is no transaction + * or the persistence context has not been joined to the transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + * @see Stream + * @see #getResultList() + * @since 2.2 + */ + default Stream getResultStream() { + return getResultList().stream(); + } + + /** + * Execute a SELECT query that returns a single result. + * @return the result + * @throws NoResultException if there is no result + * @throws NonUniqueResultException if more than one result + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode other than + * NONE has been set and there is no transaction + * or the persistence context has not been joined to the + * transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + X getSingleResult(); + + /** + * Set the maximum number of results to retrieve. + * @param maxResult maximum number of results to retrieve + * @return the same query instance + * @throws IllegalArgumentException if the argument is negative + */ + TypedQuery setMaxResults(int maxResult); + + /** + * Set the position of the first result to retrieve. + * @param startPosition position of the first result, + * numbered from 0 + * @return the same query instance + * @throws IllegalArgumentException if the argument is negative + */ + TypedQuery setFirstResult(int startPosition); + + /** + * Set a query property or hint. The hints elements may be used + * to specify query properties and hints. Properties defined by + * this specification must be observed by the provider. + * Vendor-specific hints that are not recognized by a provider + * must be silently ignored. Portable applications should not + * rely on the standard timeout hint. Depending on the database + * in use and the locking mechanisms used by the provider, + * this hint may or may not be observed. + * @param hintName name of property or hint + * @param value value for the property or hint + * @return the same query instance + * @throws IllegalArgumentException if the second argument is not + * valid for the implementation + */ + TypedQuery setHint(String hintName, Object value); + + /** + * Bind the value of a Parameter object. + * @param param parameter object + * @param value parameter value + * @return the same query instance + * @throws IllegalArgumentException if the parameter + * does not correspond to a parameter of the + * query + */ + TypedQuery setParameter(Parameter param, T value); + + /** + * Bind an instance of java.util.Calendar to a Parameter object. + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + TypedQuery setParameter(Parameter param, + Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a Parameter object. + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + TypedQuery setParameter(Parameter param, Date value, + TemporalType temporalType); + + /** + * Bind an argument value to a named parameter. + * @param name parameter name + * @param value parameter value + * @return the same query instance + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the argument is of incorrect type + */ + TypedQuery setParameter(String name, Object value); + + /** + * Bind an instance of java.util.Calendar to a named parameter. + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the value argument is of incorrect type + */ + TypedQuery setParameter(String name, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a named parameter. + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the value argument is of incorrect type + */ + TypedQuery setParameter(String name, Date value, + TemporalType temporalType); + + /** + * Bind an argument value to a positional parameter. + * @param position position + * @param value parameter value + * @return the same query instance + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the + * query or if the argument is of incorrect type + */ + TypedQuery setParameter(int position, Object value); + + /** + * Bind an instance of java.util.Calendar to a positional + * parameter. + * @param position position + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query + * or if the value argument is of incorrect type + */ + TypedQuery setParameter(int position, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a positional parameter. + * @param position position + * @param value parameter value + * @param temporalType temporal type + * @return the same query instance + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query + * or if the value argument is of incorrect type + */ + TypedQuery setParameter(int position, Date value, + TemporalType temporalType); + + /** + * Set the flush mode type to be used for the query execution. + * The flush mode type applies to the query regardless of the + * flush mode type in use for the entity manager. + * @param flushMode flush mode + * @return the same query instance + */ + TypedQuery setFlushMode(FlushModeType flushMode); + + /** + * Set the lock mode type to be used for the query execution. + * @param lockMode lock mode + * @return the same query instance + * @throws IllegalStateException if the query is found not to + * be a Java Persistence query language SELECT query + * or a CriteriaQuery query + */ + TypedQuery setLockMode(LockModeType lockMode); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/UniqueConstraint.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/UniqueConstraint.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/UniqueConstraint.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,52 @@ +/******************************************************************************* + * 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.RetentionPolicy.RUNTIME; + +/** + * Specifies that a unique constraint is to be included in + * the generated DDL for a primary or secondary table. + * + *
+ *    Example:
+ *    @Entity
+ *    @Table(
+ *        name="EMPLOYEE", 
+ *        uniqueConstraints=
+ *            @UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
+ *    )
+ *    public class Employee { ... }
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target({}) +@Retention(RUNTIME) +public @interface UniqueConstraint { + + /** (Optional) Constraint name. A provider-chosen name will be chosen + * if a name is not specified. + * + * @since Java Persistence 2.0 + */ + String name() default ""; + + /** (Required) An array of the column names that make up the constraint. */ + String[] columnNames(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/ValidationMode.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/ValidationMode.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/ValidationMode.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,46 @@ +/******************************************************************************* + * 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; + +/** + * The validation mode to be used by the provider for the persistence + * unit. + * + * @since Java Persistence 2.0 + */ +public enum ValidationMode { + + /** + * If a Bean Validation provider is present in the environment, + * the persistence provider must perform the automatic validation + * of entities. If no Bean Validation provider is present in the + * environment, no lifecycle event validation takes place. + * This is the default behavior. + */ + AUTO, + + /** + * The persistence provider must perform the lifecycle event + * validation. It is an error if there is no Bean Validation + * provider present in the environment. + */ + CALLBACK, + + /** + * The persistence provider must not perform lifecycle event validation. + */ + NONE + } Index: 3rdParty_sources/persistence-api/javax/persistence/Version.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/Version.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/Version.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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; + +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 version field or property of an entity class that + * serves as its optimistic lock value. The version is used to ensure + * integrity when performing the merge operation and for optimistic + * concurrency control. + * + *

Only a single Version property or field + * should be used per class; applications that use more than one + * Version property or field will not be portable. + * + *

The Version property should be mapped to + * the primary table for the entity class; applications that + * map the Version property to a table other than + * the primary table will not be portable. + * + *

The following types are supported for version properties: + * int, Integer, short, + * Short, long, Long, + * java.sql.Timestamp. + * + *

+ *    Example:
+ *
+ *    @Version
+ *    @Column(name="OPTLOCK")
+ *    protected int getVersionNum() { return versionNum; }
+ * 
+ * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Version {} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/AbstractQuery.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/AbstractQuery.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/AbstractQuery.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,182 @@ +/******************************************************************************* + * 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.criteria; + +import java.util.List; +import java.util.Set; +import javax.persistence.metamodel.EntityType; + +/** + * The AbstractQuery interface defines functionality that is common + * to both top-level queries and subqueries. + * It is not intended to be used directly in query construction. + * + *

All queries must have: + * a set of root entities (which may in turn own joins). + *

All queries may have: + * a conjunction of restrictions. + * + * @param the type of the result + * + * @since Java Persistence 2.0 + */ +public interface AbstractQuery extends CommonAbstractCriteria { + + /** + * Create and add a query root corresponding to the given entity, + * forming a cartesian product with any existing roots. + * @param entityClass the entity class + * @return query root corresponding to the given entity + */ + Root from(Class entityClass); + + /** + * Create and add a query root corresponding to the given entity, + * forming a cartesian product with any existing roots. + * @param entity metamodel entity representing the entity + * of type X + * @return query root corresponding to the given entity + */ + Root from(EntityType entity); + + /** + * Modify the query to restrict the query results according + * to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * @param restriction a simple or compound boolean expression + * @return the modified query + */ + AbstractQuery where(Expression restriction); + + /** + * Modify the query to restrict the query results according + * to the conjunction of the specified restriction predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * @param restrictions zero or more restriction predicates + * @return the modified query + */ + AbstractQuery where(Predicate... restrictions); + + /** + * Specify the expressions that are used to form groups over + * the query results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * @param grouping zero or more grouping expressions + * @return the modified query + */ + AbstractQuery groupBy(Expression... grouping); + + /** + * Specify the expressions that are used to form groups over + * the query results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * @param grouping list of zero or more grouping expressions + * @return the modified query + */ + AbstractQuery groupBy(List> grouping); + + /** + * Specify a restriction over the groups of the query. + * Replaces the previous having restriction(s), if any. + * @param restriction a simple or compound boolean expression + * @return the modified query + */ + AbstractQuery having(Expression restriction); + + /** + * Specify restrictions over the groups of the query + * according the conjunction of the specified restriction + * predicates. + * Replaces the previously having added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * @param restrictions zero or more restriction predicates + * @return the modified query + */ + AbstractQuery having(Predicate... restrictions); + + /** + * Specify whether duplicate query results will be eliminated. + * A true value will cause duplicates to be eliminated. + * A false value will cause duplicates to be retained. + * If distinct has not been specified, duplicate results must + * be retained. + * @param distinct boolean value specifying whether duplicate + * results must be eliminated from the query result or + * whether they must be retained + * @return the modified query + */ + AbstractQuery distinct(boolean distinct); + + /** + * Return the query roots. These are the roots that have + * been defined for the CriteriaQuery or Subquery itself, + * including any subquery roots defined as a result of + * correlation. Returns empty set if no roots have been defined. + * Modifications to the set do not affect the query. + * @return the set of query roots + */ + Set> getRoots(); + + /** + * Return the selection of the query, or null if no selection + * has been set. + * @return selection item + */ + Selection getSelection(); + + /** + * Return a list of the grouping expressions. Returns empty + * list if no grouping expressions have been specified. + * Modifications to the list do not affect the query. + * @return the list of grouping expressions + */ + List> getGroupList(); + + /** + * Return the predicate that corresponds to the restriction(s) + * over the grouping items, or null if no restrictions have + * been specified. + * @return having clause predicate + */ + Predicate getGroupRestriction(); + + /** + * Return whether duplicate query results must be eliminated or + * retained. + * @return boolean indicating whether duplicate query results + * must be eliminated + */ + boolean isDistinct(); + + /** + * Return the result type of the query or subquery. If a result + * type was specified as an argument to the + * createQuery or subquery method, that + * type will be returned. If the query was created using the + * createTupleQuery method, the result type is + * Tuple. Otherwise, the result type is + * Object. + * @return result type + */ + Class getResultType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/CollectionJoin.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/CollectionJoin.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/CollectionJoin.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,61 @@ +/******************************************************************************* + * 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.criteria; + +import java.util.Collection; +import javax.persistence.metamodel.CollectionAttribute; + +/** + * The CollectionJoin interface is the type of the result of + * joining to a collection over an association or element + * collection that has been specified as a java.util.Collection. + * + * @param the source type of the join + * @param the element type of the target Collection + * + * @since Java Persistence 2.0 + */ +public interface CollectionJoin + extends PluralJoin, E> { + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restriction a simple or compound boolean expression + * @return the modified join object + * @since Java Persistence 2.1 + */ + CollectionJoin on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restrictions zero or more restriction predicates + * @return the modified join object + * @since Java Persistence 2.1 + */ + CollectionJoin on(Predicate... restrictions); + + /** + * Return the metamodel representation for the collection + * attribute. + * @return metamodel type representing the Collection that is + * the target of the join + */ + CollectionAttribute getModel(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/CommonAbstractCriteria.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/CommonAbstractCriteria.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/CommonAbstractCriteria.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,49 @@ +/******************************************************************************* + * 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.criteria; + +/** + * The CommonAbstractCriteria interface defines functionality + * that is common to both top-level criteria queries and subqueries as + * well as to update and delete criteria operations. + * It is not intended to be used directly in query construction. + * + *

Note that criteria queries and criteria update and delete operations + * are typed differently. + * Criteria queries are typed according to the query result type. + * Update and delete operations are typed according to the target of the + * update or delete. + * + * @since Java Persistence 2.1 + */ +public interface CommonAbstractCriteria { + + /** + * Create a subquery of the query. + * @param type the subquery result type + * @return subquery + */ + Subquery subquery(Class type); + + /** + * Return the predicate that corresponds to the where clause + * restriction(s), or null if no restrictions have been + * specified. + * @return where clause predicate + */ + Predicate getRestriction(); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/CompoundSelection.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/CompoundSelection.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/CompoundSelection.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,26 @@ +/******************************************************************************* + * 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.criteria; + +/** + * The CompoundSelection interface defines a compound selection item + * (tuple, array, or result of constructor). + * + * @param the type of the selection item + * + * @since Java Persistence 2.0 + */ +public interface CompoundSelection extends Selection {} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaBuilder.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaBuilder.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaBuilder.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,1532 @@ +/******************************************************************************* + * 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.criteria; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Collection; +import java.util.Map; +import java.util.Set; +import javax.persistence.Tuple; + +/** + * Used to construct criteria queries, compound selections, + * expressions, predicates, orderings. + * + *

Note that Predicate is used instead of Expression<Boolean> + * in this API in order to work around the fact that Java + * generics are not compatible with varags. + * + * @since Java Persistence 2.0 + */ +public interface CriteriaBuilder { + + /** + * Create a CriteriaQuery object. + * @return criteria query object + */ + CriteriaQuery createQuery(); + + /** + * Create a CriteriaQuery object with the specified result + * type. + * @param resultClass type of the query result + * @return criteria query object + */ + CriteriaQuery createQuery(Class resultClass); + + /** + * Create a CriteriaQuery object that returns a tuple of + * objects as its result. + * @return criteria query object + */ + CriteriaQuery createTupleQuery(); + + // methods to construct queries for bulk updates and deletes: + + /** + * Create a CriteriaUpdate query object to perform a bulk update operation. + * @param targetEntity target type for update operation + * @return the query object + * @since Java Persistence 2.1 + */ + CriteriaUpdate createCriteriaUpdate(Class targetEntity); + + /** + * Create a CriteriaDelete query object to perform a bulk delete operation. + * @param targetEntity target type for delete operation + * @return the query object + * @since Java Persistence 2.1 + */ + CriteriaDelete createCriteriaDelete(Class targetEntity); + + + // selection construction methods: + + /** + * Create a selection item corresponding to a constructor. + * This method is used to specify a constructor that will be + * applied to the results of the query execution. If the + * constructor is for an entity class, the resulting entities + * will be in the new state after the query is executed. + * @param resultClass class whose instance is to be constructed + * @param selections arguments to the constructor + * @return compound selection item + * @throws IllegalArgumentException if an argument is a + * tuple- or array-valued selection item + */ + CompoundSelection construct(Class resultClass, Selection... selections); + + /** + * Create a tuple-valued selection item. + * @param selections selection items + * @return tuple-valued compound selection + * @throws IllegalArgumentException if an argument is a + * tuple- or array-valued selection item + */ + CompoundSelection tuple(Selection... selections); + + /** + * Create an array-valued selection item. + * @param selections selection items + * @return array-valued compound selection + * @throws IllegalArgumentException if an argument is a + * tuple- or array-valued selection item + */ + CompoundSelection array(Selection... selections); + + + //ordering: + + /** + * Create an ordering by the ascending value of the expression. + * @param x expression used to define the ordering + * @return ascending ordering corresponding to the expression + */ + Order asc(Expression x); + + /** + * Create an ordering by the descending value of the expression. + * @param x expression used to define the ordering + * @return descending ordering corresponding to the expression + */ + Order desc(Expression x); + + + //aggregate functions: + + /** + * Create an aggregate expression applying the avg operation. + * @param x expression representing input value to avg operation + * @return avg expression + */ + Expression avg(Expression x); + + /** + * Create an aggregate expression applying the sum operation. + * @param x expression representing input value to sum operation + * @return sum expression + */ + Expression sum(Expression x); + + /** + * Create an aggregate expression applying the sum operation to an + * Integer-valued expression, returning a Long result. + * @param x expression representing input value to sum operation + * @return sum expression + */ + Expression sumAsLong(Expression x); + + /** + * Create an aggregate expression applying the sum operation to a + * Float-valued expression, returning a Double result. + * @param x expression representing input value to sum operation + * @return sum expression + */ + Expression sumAsDouble(Expression x); + + /** + * Create an aggregate expression applying the numerical max + * operation. + * @param x expression representing input value to max operation + * @return max expression + */ + Expression max(Expression x); + + /** + * Create an aggregate expression applying the numerical min + * operation. + * @param x expression representing input value to min operation + * @return min expression + */ + Expression min(Expression x); + + /** + * Create an aggregate expression for finding the greatest of + * the values (strings, dates, etc). + * @param x expression representing input value to greatest + * operation + * @return greatest expression + */ + > Expression greatest(Expression x); + + /** + * Create an aggregate expression for finding the least of + * the values (strings, dates, etc). + * @param x expression representing input value to least + * operation + * @return least expression + */ + > Expression least(Expression x); + + /** + * Create an aggregate expression applying the count operation. + * @param x expression representing input value to count + * operation + * @return count expression + */ + Expression count(Expression x); + + /** + * Create an aggregate expression applying the count distinct + * operation. + * @param x expression representing input value to + * count distinct operation + * @return count distinct expression + */ + Expression countDistinct(Expression x); + + + + //subqueries: + + /** + * Create a predicate testing the existence of a subquery result. + * @param subquery subquery whose result is to be tested + * @return exists predicate + */ + Predicate exists(Subquery subquery); + + /** + * Create an all expression over the subquery results. + * @param subquery subquery + * @return all expression + */ + Expression all(Subquery subquery); + + /** + * Create a some expression over the subquery results. + * This expression is equivalent to an any expression. + * @param subquery subquery + * @return some expression + */ + Expression some(Subquery subquery); + + /** + * Create an any expression over the subquery results. + * This expression is equivalent to a some expression. + * @param subquery subquery + * @return any expression + */ + Expression any(Subquery subquery); + + + //boolean functions: + + /** + * Create a conjunction of the given boolean expressions. + * @param x boolean expression + * @param y boolean expression + * @return and predicate + */ + Predicate and(Expression x, Expression y); + + /** + * Create a conjunction of the given restriction predicates. + * A conjunction of zero predicates is true. + * @param restrictions zero or more restriction predicates + * @return and predicate + */ + Predicate and(Predicate... restrictions); + + /** + * Create a disjunction of the given boolean expressions. + * @param x boolean expression + * @param y boolean expression + * @return or predicate + */ + Predicate or(Expression x, Expression y); + + /** + * Create a disjunction of the given restriction predicates. + * A disjunction of zero predicates is false. + * @param restrictions zero or more restriction predicates + * @return or predicate + */ + Predicate or(Predicate... restrictions); + + /** + * Create a negation of the given restriction. + * @param restriction restriction expression + * @return not predicate + */ + Predicate not(Expression restriction); + + /** + * Create a conjunction (with zero conjuncts). + * A conjunction with zero conjuncts is true. + * @return and predicate + */ + Predicate conjunction(); + + /** + * Create a disjunction (with zero disjuncts). + * A disjunction with zero disjuncts is false. + * @return or predicate + */ + Predicate disjunction(); + + + //turn Expression into a Predicate + //useful for use with varargs methods + + /** + * Create a predicate testing for a true value. + * @param x expression to be tested + * @return predicate + */ + Predicate isTrue(Expression x); + + /** + * Create a predicate testing for a false value. + * @param x expression to be tested + * @return predicate + */ + Predicate isFalse(Expression x); + + + //null tests: + + /** + * Create a predicate to test whether the expression is null. + * @param x expression + * @return is-null predicate + */ + Predicate isNull(Expression x); + + /** + * Create a predicate to test whether the expression is not null. + * @param x expression + * @return is-not-null predicate + */ + Predicate isNotNull(Expression x); + + //equality: + + /** + * Create a predicate for testing the arguments for equality. + * @param x expression + * @param y expression + * @return equality predicate + */ + Predicate equal(Expression x, Expression y); + + /** + * Create a predicate for testing the arguments for equality. + * @param x expression + * @param y object + * @return equality predicate + */ + Predicate equal(Expression x, Object y); + + /** + * Create a predicate for testing the arguments for inequality. + * @param x expression + * @param y expression + * @return inequality predicate + */ + Predicate notEqual(Expression x, Expression y); + + /** + * Create a predicate for testing the arguments for inequality. + * @param x expression + * @param y object + * @return inequality predicate + */ + Predicate notEqual(Expression x, Object y); + + + //comparisons for generic (non-numeric) operands: + + /** + * Create a predicate for testing whether the first argument is + * greater than the second. + * @param x expression + * @param y expression + * @return greater-than predicate + */ + > Predicate greaterThan(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * greater than the second. + * @param x expression + * @param y value + * @return greater-than predicate + */ + > Predicate greaterThan(Expression x, Y y); + + /** + * Create a predicate for testing whether the first argument is + * greater than or equal to the second. + * @param x expression + * @param y expression + * @return greater-than-or-equal predicate + */ + > Predicate greaterThanOrEqualTo(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * greater than or equal to the second. + * @param x expression + * @param y value + * @return greater-than-or-equal predicate + */ + > Predicate greaterThanOrEqualTo(Expression x, Y y); + + /** + * Create a predicate for testing whether the first argument is + * less than the second. + * @param x expression + * @param y expression + * @return less-than predicate + */ + > Predicate lessThan(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * less than the second. + * @param x expression + * @param y value + * @return less-than predicate + */ + > Predicate lessThan(Expression x, Y y); + + /** + * Create a predicate for testing whether the first argument is + * less than or equal to the second. + * @param x expression + * @param y expression + * @return less-than-or-equal predicate + */ + > Predicate lessThanOrEqualTo(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * less than or equal to the second. + * @param x expression + * @param y value + * @return less-than-or-equal predicate + */ + > Predicate lessThanOrEqualTo(Expression x, Y y); + + /** + * Create a predicate for testing whether the first argument is + * between the second and third arguments in value. + * @param v expression + * @param x expression + * @param y expression + * @return between predicate + */ + > Predicate between(Expression v, Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * between the second and third arguments in value. + * @param v expression + * @param x value + * @param y value + * @return between predicate + */ + > Predicate between(Expression v, Y x, Y y); + + + //comparisons for numeric operands: + + /** + * Create a predicate for testing whether the first argument is + * greater than the second. + * @param x expression + * @param y expression + * @return greater-than predicate + */ + Predicate gt(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * greater than the second. + * @param x expression + * @param y value + * @return greater-than predicate + */ + Predicate gt(Expression x, Number y); + + /** + * Create a predicate for testing whether the first argument is + * greater than or equal to the second. + * @param x expression + * @param y expression + * @return greater-than-or-equal predicate + */ + Predicate ge(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * greater than or equal to the second. + * @param x expression + * @param y value + * @return greater-than-or-equal predicate + */ + Predicate ge(Expression x, Number y); + + /** + * Create a predicate for testing whether the first argument is + * less than the second. + * @param x expression + * @param y expression + * @return less-than predicate + */ + Predicate lt(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * less than the second. + * @param x expression + * @param y value + * @return less-than predicate + */ + Predicate lt(Expression x, Number y); + + /** + * Create a predicate for testing whether the first argument is + * less than or equal to the second. + * @param x expression + * @param y expression + * @return less-than-or-equal predicate + */ + Predicate le(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * less than or equal to the second. + * @param x expression + * @param y value + * @return less-than-or-equal predicate + */ + Predicate le(Expression x, Number y); + + + //numerical operations: + + /** + * Create an expression that returns the arithmetic negation + * of its argument. + * @param x expression + * @return arithmetic negation + */ + Expression neg(Expression x); + + /** + * Create an expression that returns the absolute value + * of its argument. + * @param x expression + * @return absolute value + */ + Expression abs(Expression x); + + /** + * Create an expression that returns the sum + * of its arguments. + * @param x expression + * @param y expression + * @return sum + */ + Expression sum(Expression x, Expression y); + + /** + * Create an expression that returns the sum + * of its arguments. + * @param x expression + * @param y value + * @return sum + */ + Expression sum(Expression x, N y); + + /** + * Create an expression that returns the sum + * of its arguments. + * @param x value + * @param y expression + * @return sum + */ + Expression sum(N x, Expression y); + + /** + * Create an expression that returns the product + * of its arguments. + * @param x expression + * @param y expression + * @return product + */ + Expression prod(Expression x, Expression y); + + /** + * Create an expression that returns the product + * of its arguments. + * @param x expression + * @param y value + * @return product + */ + Expression prod(Expression x, N y); + + /** + * Create an expression that returns the product + * of its arguments. + * @param x value + * @param y expression + * @return product + */ + Expression prod(N x, Expression y); + + /** + * Create an expression that returns the difference + * between its arguments. + * @param x expression + * @param y expression + * @return difference + */ + Expression diff(Expression x, Expression y); + + /** + * Create an expression that returns the difference + * between its arguments. + * @param x expression + * @param y value + * @return difference + */ + Expression diff(Expression x, N y); + + /** + * Create an expression that returns the difference + * between its arguments. + * @param x value + * @param y expression + * @return difference + */ + Expression diff(N x, Expression y); + + /** + * Create an expression that returns the quotient + * of its arguments. + * @param x expression + * @param y expression + * @return quotient + */ + Expression quot(Expression x, Expression y); + + /** + * Create an expression that returns the quotient + * of its arguments. + * @param x expression + * @param y value + * @return quotient + */ + Expression quot(Expression x, Number y); + + /** + * Create an expression that returns the quotient + * of its arguments. + * @param x value + * @param y expression + * @return quotient + */ + Expression quot(Number x, Expression y); + + /** + * Create an expression that returns the modulus + * of its arguments. + * @param x expression + * @param y expression + * @return modulus + */ + Expression mod(Expression x, Expression y); + + /** + * Create an expression that returns the modulus + * of its arguments. + * @param x expression + * @param y value + * @return modulus + */ + Expression mod(Expression x, Integer y); + + /** + * Create an expression that returns the modulus + * of its arguments. + * @param x value + * @param y expression + * @return modulus + */ + Expression mod(Integer x, Expression y); + + /** + * Create an expression that returns the square root + * of its argument. + * @param x expression + * @return square root + */ + Expression sqrt(Expression x); + + + //typecasts: + + /** + * Typecast. Returns same expression object. + * @param number numeric expression + * @return Expression<Long> + */ + Expression toLong(Expression number); + + /** + * Typecast. Returns same expression object. + * @param number numeric expression + * @return Expression<Integer> + */ + Expression toInteger(Expression number); + + /** + * Typecast. Returns same expression object. + * @param number numeric expression + * @return Expression<Float> + */ + Expression toFloat(Expression number); + + /** + * Typecast. Returns same expression object. + * @param number numeric expression + * @return Expression<Double> + */ + Expression toDouble(Expression number); + + /** + * Typecast. Returns same expression object. + * @param number numeric expression + * @return Expression<BigDecimal> + */ + Expression toBigDecimal(Expression number); + + /** + * Typecast. Returns same expression object. + * @param number numeric expression + * @return Expression<BigInteger> + */ + Expression toBigInteger(Expression number); + + /** + * Typecast. Returns same expression object. + * @param character expression + * @return Expression<String> + */ + Expression toString(Expression character); + + + //literals: + + /** + * Create an expression for a literal. + * @param value value represented by the expression + * @return expression literal + * @throws IllegalArgumentException if value is null + */ + Expression literal(T value); + + /** + * Create an expression for a null literal with the given type. + * @param resultClass type of the null literal + * @return null expression literal + */ + Expression nullLiteral(Class resultClass); + + //parameters: + + /** + * Create a parameter expression. + * @param paramClass parameter class + * @return parameter expression + */ + ParameterExpression parameter(Class paramClass); + + /** + * Create a parameter expression with the given name. + * @param paramClass parameter class + * @param name name that can be used to refer to + * the parameter + * @return parameter expression + */ + ParameterExpression parameter(Class paramClass, String name); + + + //collection operations: + + /** + * Create a predicate that tests whether a collection is empty. + * @param collection expression + * @return is-empty predicate + */ + > Predicate isEmpty(Expression collection); + + /** + * Create a predicate that tests whether a collection is + * not empty. + * @param collection expression + * @return is-not-empty predicate + */ + > Predicate isNotEmpty(Expression collection); + + /** + * Create an expression that tests the size of a collection. + * @param collection expression + * @return size expression + */ + > Expression size(Expression collection); + + /** + * Create an expression that tests the size of a collection. + * @param collection collection + * @return size expression + */ + > Expression size(C collection); + + /** + * Create a predicate that tests whether an element is + * a member of a collection. + * If the collection is empty, the predicate will be false. + * @param elem element expression + * @param collection expression + * @return is-member predicate + */ + > Predicate isMember(Expression elem, Expression collection); + + /** + * Create a predicate that tests whether an element is + * a member of a collection. + * If the collection is empty, the predicate will be false. + * @param elem element + * @param collection expression + * @return is-member predicate + */ + > Predicate isMember(E elem, Expression collection); + + /** + * Create a predicate that tests whether an element is + * not a member of a collection. + * If the collection is empty, the predicate will be true. + * @param elem element expression + * @param collection expression + * @return is-not-member predicate + */ + > Predicate isNotMember(Expression elem, Expression collection); + + /** + * Create a predicate that tests whether an element is + * not a member of a collection. + * If the collection is empty, the predicate will be true. + * @param elem element + * @param collection expression + * @return is-not-member predicate + */ + > Predicate isNotMember(E elem, Expression collection); + + + //get the values and keys collections of the Map, which may then + //be passed to size(), isMember(), isEmpty(), etc + + /** + * Create an expression that returns the values of a map. + * @param map map + * @return collection expression + */ + > Expression> values(M map); + + /** + * Create an expression that returns the keys of a map. + * @param map map + * @return set expression + */ + > Expression> keys(M map); + + + //string functions: + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * @param x string expression + * @param pattern string expression + * @return like predicate + */ + Predicate like(Expression x, Expression pattern); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * @param x string expression + * @param pattern string + * @return like predicate + */ + Predicate like(Expression x, String pattern); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * @param x string expression + * @param pattern string expression + * @param escapeChar escape character expression + * @return like predicate + */ + Predicate like(Expression x, Expression pattern, Expression escapeChar); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * @param x string expression + * @param pattern string expression + * @param escapeChar escape character + * @return like predicate + */ + Predicate like(Expression x, Expression pattern, char escapeChar); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * @param x string expression + * @param pattern string + * @param escapeChar escape character expression + * @return like predicate + */ + Predicate like(Expression x, String pattern, Expression escapeChar); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * @param x string expression + * @param pattern string + * @param escapeChar escape character + * @return like predicate + */ + Predicate like(Expression x, String pattern, char escapeChar); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * @param x string expression + * @param pattern string expression + * @return not-like predicate + */ + Predicate notLike(Expression x, Expression pattern); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * @param x string expression + * @param pattern string + * @return not-like predicate + */ + Predicate notLike(Expression x, String pattern); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * @param x string expression + * @param pattern string expression + * @param escapeChar escape character expression + * @return not-like predicate + */ + Predicate notLike(Expression x, Expression pattern, Expression escapeChar); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * @param x string expression + * @param pattern string expression + * @param escapeChar escape character + * @return not-like predicate + */ + Predicate notLike(Expression x, Expression pattern, char escapeChar); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * @param x string expression + * @param pattern string + * @param escapeChar escape character expression + * @return not-like predicate + */ + Predicate notLike(Expression x, String pattern, Expression escapeChar); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * @param x string expression + * @param pattern string + * @param escapeChar escape character + * @return not-like predicate + */ + Predicate notLike(Expression x, String pattern, char escapeChar); + + /** + * Create an expression for string concatenation. + * @param x string expression + * @param y string expression + * @return expression corresponding to concatenation + */ + Expression concat(Expression x, Expression y); + + /** + * Create an expression for string concatenation. + * @param x string expression + * @param y string + * @return expression corresponding to concatenation + */ + Expression concat(Expression x, String y); + + /** + * Create an expression for string concatenation. + * @param x string + * @param y string expression + * @return expression corresponding to concatenation + */ + Expression concat(String x, Expression y); + + /** + * Create an expression for substring extraction. + * Extracts a substring starting at the specified position + * through to end of the string. + * First position is 1. + * @param x string expression + * @param from start position expression + * @return expression corresponding to substring extraction + */ + Expression substring(Expression x, Expression from); + + /** + * Create an expression for substring extraction. + * Extracts a substring starting at the specified position + * through to end of the string. + * First position is 1. + * @param x string expression + * @param from start position + * @return expression corresponding to substring extraction + */ + Expression substring(Expression x, int from); + + /** + * Create an expression for substring extraction. + * Extracts a substring of given length starting at the + * specified position. + * First position is 1. + * @param x string expression + * @param from start position expression + * @param len length expression + * @return expression corresponding to substring extraction + */ + Expression substring(Expression x, Expression from, Expression len); + + /** + * Create an expression for substring extraction. + * Extracts a substring of given length starting at the + * specified position. + * First position is 1. + * @param x string expression + * @param from start position + * @param len length + * @return expression corresponding to substring extraction + */ + Expression substring(Expression x, int from, int len); + + /** + * Used to specify how strings are trimmed. + */ + public static enum Trimspec { + + /** + * Trim from leading end. + */ + LEADING, + + /** + * Trim from trailing end. + */ + TRAILING, + + /** + * Trim from both ends. + */ + BOTH + } + + /** + * Create expression to trim blanks from both ends of + * a string. + * @param x expression for string to trim + * @return trim expression + */ + Expression trim(Expression x); + + /** + * Create expression to trim blanks from a string. + * @param ts trim specification + * @param x expression for string to trim + * @return trim expression + */ + Expression trim(Trimspec ts, Expression x); + + /** + * Create expression to trim character from both ends of + * a string. + * @param t expression for character to be trimmed + * @param x expression for string to trim + * @return trim expression + */ + Expression trim(Expression t, Expression x); + + /** + * Create expression to trim character from a string. + * @param ts trim specification + * @param t expression for character to be trimmed + * @param x expression for string to trim + * @return trim expression + */ + Expression trim(Trimspec ts, Expression t, Expression x); + + /** + * Create expression to trim character from both ends of + * a string. + * @param t character to be trimmed + * @param x expression for string to trim + * @return trim expression + */ + Expression trim(char t, Expression x); + + /** + * Create expression to trim character from a string. + * @param ts trim specification + * @param t character to be trimmed + * @param x expression for string to trim + * @return trim expression + */ + Expression trim(Trimspec ts, char t, Expression x); + + /** + * Create expression for converting a string to lowercase. + * @param x string expression + * @return expression to convert to lowercase + */ + Expression lower(Expression x); + + /** + * Create expression for converting a string to uppercase. + * @param x string expression + * @return expression to convert to uppercase + */ + Expression upper(Expression x); + + /** + * Create expression to return length of a string. + * @param x string expression + * @return length expression + */ + Expression length(Expression x); + + + /** + * Create expression to locate the position of one string + * within another, returning position of first character + * if found. + * The first position in a string is denoted by 1. If the + * string to be located is not found, 0 is returned. + * @param x expression for string to be searched + * @param pattern expression for string to be located + * @return expression corresponding to position + */ + Expression locate(Expression x, Expression pattern); + + /** + * Create expression to locate the position of one string + * within another, returning position of first character + * if found. + * The first position in a string is denoted by 1. If the + * string to be located is not found, 0 is returned. + * @param x expression for string to be searched + * @param pattern string to be located + * @return expression corresponding to position + */ + Expression locate(Expression x, String pattern); + + /** + * Create expression to locate the position of one string + * within another, returning position of first character + * if found. + * The first position in a string is denoted by 1. If the + * string to be located is not found, 0 is returned. + * @param x expression for string to be searched + * @param pattern expression for string to be located + * @param from expression for position at which to start search + * @return expression corresponding to position + */ + Expression locate(Expression x, Expression pattern, Expression from); + + /** + * Create expression to locate the position of one string + * within another, returning position of first character + * if found. + * The first position in a string is denoted by 1. If the + * string to be located is not found, 0 is returned. + * @param x expression for string to be searched + * @param pattern string to be located + * @param from position at which to start search + * @return expression corresponding to position + */ + Expression locate(Expression x, String pattern, int from); + + + // Date/time/timestamp functions: + + /** + * Create expression to return current date. + * @return expression for current date + */ + Expression currentDate(); + + /** + * Create expression to return current timestamp. + * @return expression for current timestamp + */ + Expression currentTimestamp(); + + /** + * Create expression to return current time. + * @return expression for current time + */ + Expression currentTime(); + + + //in builders: + + /** + * Interface used to build in predicates. + */ + public static interface In extends Predicate { + + /** + * Return the expression to be tested against the + * list of values. + * @return expression + */ + Expression getExpression(); + + /** + * Add to list of values to be tested against. + * @param value value + * @return in predicate + */ + In value(T value); + + /** + * Add to list of values to be tested against. + * @param value expression + * @return in predicate + */ + In value(Expression value); + } + + /** + * Create predicate to test whether given expression + * is contained in a list of values. + * @param expression to be tested against list of values + * @return in predicate + */ + In in(Expression expression); + + + // coalesce, nullif: + + /** + * Create an expression that returns null if all its arguments + * evaluate to null, and the value of the first non-null argument + * otherwise. + * @param x expression + * @param y expression + * @return coalesce expression + */ + Expression coalesce(Expression x, Expression y); + + /** + * Create an expression that returns null if all its arguments + * evaluate to null, and the value of the first non-null argument + * otherwise. + * @param x expression + * @param y value + * @return coalesce expression + */ + Expression coalesce(Expression x, Y y); + + /** + * Create an expression that tests whether its argument are + * equal, returning null if they are and the value of the + * first expression if they are not. + * @param x expression + * @param y expression + * @return nullif expression + */ + Expression nullif(Expression x, Expression y); + + /** + * Create an expression that tests whether its argument are + * equal, returning null if they are and the value of the + * first expression if they are not. + * @param x expression + * @param y value + * @return nullif expression + */ + Expression nullif(Expression x, Y y); + + + // coalesce builder: + + /** + * Interface used to build coalesce expressions. + * + * A coalesce expression is equivalent to a case expression + * that returns null if all its arguments evaluate to null, + * and the value of its first non-null argument otherwise. + */ + public static interface Coalesce extends Expression { + + /** + * Add an argument to the coalesce expression. + * @param value value + * @return coalesce expression + */ + Coalesce value(T value); + + /** + * Add an argument to the coalesce expression. + * @param value expression + * @return coalesce expression + */ + Coalesce value(Expression value); + } + + /** + * Create a coalesce expression. + * @return coalesce expression + */ + Coalesce coalesce(); + + + //case builders: + + /** + * Interface used to build simple case expressions. + * Case conditions are evaluated in the order in which + * they are specified. + */ + public static interface SimpleCase extends Expression { + + /** + * Return the expression to be tested against the + * conditions. + * @return expression + */ + Expression getExpression(); + + /** + * Add a when/then clause to the case expression. + * @param condition "when" condition + * @param result "then" result value + * @return simple case expression + */ + SimpleCase when(C condition, R result); + + /** + * Add a when/then clause to the case expression. + * @param condition "when" condition + * @param result "then" result expression + * @return simple case expression + */ + SimpleCase when(C condition, Expression result); + + /** + * Add an "else" clause to the case expression. + * @param result "else" result + * @return expression + */ + Expression otherwise(R result); + + /** + * Add an "else" clause to the case expression. + * @param result "else" result expression + * @return expression + */ + Expression otherwise(Expression result); + } + + /** + * Create a simple case expression. + * @param expression to be tested against the case conditions + * @return simple case expression + */ + SimpleCase selectCase(Expression expression); + + + /** + * Interface used to build general case expressions. + * Case conditions are evaluated in the order in which + * they are specified. + */ + public static interface Case extends Expression { + + /** + * Add a when/then clause to the case expression. + * @param condition "when" condition + * @param result "then" result value + * @return general case expression + */ + Case when(Expression condition, R result); + + /** + * Add a when/then clause to the case expression. + * @param condition "when" condition + * @param result "then" result expression + * @return general case expression + */ + Case when(Expression condition, Expression result); + + /** + * Add an "else" clause to the case expression. + * @param result "else" result + * @return expression + */ + Expression otherwise(R result); + + /** + * Add an "else" clause to the case expression. + * @param result "else" result expression + * @return expression + */ + Expression otherwise(Expression result); + } + + /** + * Create a general case expression. + * @return general case expression + */ + Case selectCase(); + + /** + * Create an expression for the execution of a database + * function. + * @param name function name + * @param type expected result type + * @param args function arguments + * @return expression + */ + Expression function(String name, Class type, +Expression... args); + + + // methods for downcasting: + + /** + * Downcast Join object to the specified type. + * @param join Join object + * @param type type to be downcast to + * @return Join object of the specified type + * @since Java Persistence 2.1 + */ + Join treat(Join join, Class type); + + /** + * Downcast CollectionJoin object to the specified type. + * @param join CollectionJoin object + * @param type type to be downcast to + * @return CollectionJoin object of the specified type + * @since Java Persistence 2.1 + */ + CollectionJoin treat(CollectionJoin join, Class type); + + /** + * Downcast SetJoin object to the specified type. + * @param join SetJoin object + * @param type type to be downcast to + * @return SetJoin object of the specified type + * @since Java Persistence 2.1 + */ + SetJoin treat(SetJoin join, Class type); + + /** + * Downcast ListJoin object to the specified type. + * @param join ListJoin object + * @param type type to be downcast to + * @return ListJoin object of the specified type + * @since Java Persistence 2.1 + */ + ListJoin treat(ListJoin join, Class type); + + /** + * Downcast MapJoin object to the specified type. + * @param join MapJoin object + * @param type type to be downcast to + * @return MapJoin object of the specified type + * @since Java Persistence 2.1 + */ + MapJoin treat(MapJoin join, Class type); + + + /** + * Downcast Path object to the specified type. + * @param path path + * @param type type to be downcast to + * @return Path object of the specified type + * @since Java Persistence 2.1 + */ + Path treat(Path path, Class type); + + /** + * Downcast Root object to the specified type. + * @param root root + * @param type type to be downcast to + * @return Root object of the specified type + * @since Java Persistence 2.1 + */ + Root treat(Root root, Class type); + +} + + + + Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaDelete.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaDelete.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaDelete.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ +package javax.persistence.criteria; + +import javax.persistence.metamodel.EntityType; + +/** + * The CriteriaDelete interface defines functionality for performing + * bulk delete operations using the Criteria API + * + *

Criteria API bulk delete operations map directly to database + * delete operations. The persistence context is not synchronized + * with the result of the bulk delete. + * + *

A CriteriaDelete object must have a single root. + * + * @param the entity type that is the target of the delete + * + * @since Java Persistence 2.1 + */ +public interface CriteriaDelete extends CommonAbstractCriteria { + + + /** + * Create and add a query root corresponding to the entity + * that is the target of the delete. + * A CriteriaDelete object has a single root, the entity that + * is being deleted. + * @param entityClass the entity class + * @return query root corresponding to the given entity + */ + Root from(Class entityClass); + + /** + * Create and add a query root corresponding to the entity + * that is the target of the delete. + * A CriteriaDelete object has a single root, the entity that + * is being deleted. + * @param entity metamodel entity representing the entity + * of type X + * @return query root corresponding to the given entity + */ + Root from(EntityType entity); + + /** + * Return the query root. + * @return the query root + */ + Root getRoot(); + + /** + * Modify the delete query to restrict the target of the deletion + * according to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * @param restriction a simple or compound boolean expression + * @return the modified delete query + */ + CriteriaDelete where(Expression restriction); + + /** + * Modify the delete query to restrict the target of the deletion + * according to the conjunction of the specified restriction + * predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * @param restrictions zero or more restriction predicates + * @return the modified delete query + */ + CriteriaDelete where(Predicate... restrictions); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaQuery.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaQuery.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaQuery.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,317 @@ +/******************************************************************************* + * 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.criteria; + +import java.util.List; +import java.util.Set; + +/** + * The CriteriaQuery interface defines functionality that is specific + * to top-level queries. + * + * @param the type of the defined result + * + * @since Java Persistence 2.0 + */ +public interface CriteriaQuery extends AbstractQuery { + + /** + * Specify the item that is to be returned in the query result. + * Replaces the previously specified selection(s), if any. + * + *

Note: Applications using the string-based API may need to + * specify the type of the select item when it results from + * a get or join operation and the query result type is + * specified. + * + *

+     *     For example:
+     *
+     *     CriteriaQuery<String> q = cb.createQuery(String.class);
+     *     Root<Order> order = q.from(Order.class);
+     *     q.select(order.get("shippingAddress").<String>get("state"));
+     * 
+     *     CriteriaQuery<Product> q2 = cb.createQuery(Product.class);
+     *     q2.select(q2.from(Order.class)
+     *                 .join("items")
+     *                 .<Item,Product>join("product"));
+     * 
+     * 
+ * @param selection selection specifying the item that + * is to be returned in the query result + * @return the modified query + * @throws IllegalArgumentException if the selection is + * a compound selection and more than one selection + * item has the same assigned alias + */ + CriteriaQuery select(Selection selection); + + /** + * Specify the selection items that are to be returned in the + * query result. + * Replaces the previously specified selection(s), if any. + * + * The type of the result of the query execution depends on + * the specification of the type of the criteria query object + * created as well as the arguments to the multiselect method. + *

An argument to the multiselect method must not be a tuple- + * or array-valued compound selection item. + * + *

The semantics of this method are as follows: + *

    + *
  • + * If the type of the criteria query is + * CriteriaQuery<Tuple> (i.e., a criteria + * query object created by either the + * createTupleQuery method or by passing a + * Tuple class argument to the + * createQuery method), a Tuple object + * corresponding to the arguments of the multiselect + * method, in the specified order, will be instantiated and + * returned for each row that results from the query execution. + * + *
  • If the type of the criteria query is CriteriaQuery<X> for + * some user-defined class X (i.e., a criteria query object + * created by passing a X class argument to the createQuery + * method), the arguments to the multiselect method will be + * passed to the X constructor and an instance of type X will be + * returned for each row. + * + *
  • If the type of the criteria query is CriteriaQuery<X[]> for + * some class X, an instance of type X[] will be returned for + * each row. The elements of the array will correspond to the + * arguments of the multiselect method, in the + * specified order. + * + *
  • If the type of the criteria query is CriteriaQuery<Object> + * or if the criteria query was created without specifying a + * type, and only a single argument is passed to the multiselect + * method, an instance of type Object will be returned for + * each row. + * + *
  • If the type of the criteria query is CriteriaQuery<Object> + * or if the criteria query was created without specifying a + * type, and more than one argument is passed to the multiselect + * method, an instance of type Object[] will be instantiated + * and returned for each row. The elements of the array will + * correspond to the arguments to the multiselect method, + * in the specified order. + *
+ * + * @param selections selection items corresponding to the + * results to be returned by the query + * @return the modified query + * @throws IllegalArgumentException if a selection item is + * not valid or if more than one selection item has + * the same assigned alias + */ + CriteriaQuery multiselect(Selection... selections); + + + /** + * Specify the selection items that are to be returned in the + * query result. + * Replaces the previously specified selection(s), if any. + * + *

The type of the result of the query execution depends on + * the specification of the type of the criteria query object + * created as well as the argument to the multiselect method. + * An element of the list passed to the multiselect method + * must not be a tuple- or array-valued compound selection item. + * + *

The semantics of this method are as follows: + *

    + *
  • If the type of the criteria query is CriteriaQuery<Tuple> + * (i.e., a criteria query object created by either the + * createTupleQuery method or by passing a Tuple class argument + * to the createQuery method), a Tuple object corresponding to + * the elements of the list passed to the multiselect method, + * in the specified order, will be instantiated and returned for each + * row that results from the query execution. + * + *
  • If the type of the criteria query is CriteriaQuery<X> for + * some user-defined class X (i.e., a criteria query object + * created by passing a X class argument to the createQuery + * method), the elements of the list passed to the multiselect + * method will be passed to the X constructor and an instance + * of type X will be returned for each row. + * + *
  • If the type of the criteria query is CriteriaQuery<X[]> for + * some class X, an instance of type X[] will be returned for + * each row. The elements of the array will correspond to the + * elements of the list passed to the multiselect method, + * in the specified order. + * + *
  • If the type of the criteria query is CriteriaQuery<Object> + * or if the criteria query was created without specifying a + * type, and the list passed to the multiselect method contains + * only a single element, an instance of type Object will be + * returned for each row. + * + *
  • If the type of the criteria query is CriteriaQuery<Object> + * or if the criteria query was created without specifying a + * type, and the list passed to the multiselect method contains + * more than one element, an instance of type Object[] will be + * instantiated and returned for each row. The elements of the + * array will correspond to the elements of the list passed to + * the multiselect method, in the specified order. + *
+ * + * @param selectionList list of selection items corresponding + * to the results to be returned by the query + * @return the modified query + * @throws IllegalArgumentException if a selection item is + * not valid or if more than one selection item has + * the same assigned alias + */ + CriteriaQuery multiselect(List> selectionList); + + /** + * Modify the query to restrict the query result according + * to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param restriction a simple or compound boolean expression + * @return the modified query + */ + CriteriaQuery where(Expression restriction); + + /** + * Modify the query to restrict the query result according + * to the conjunction of the specified restriction predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param restrictions zero or more restriction predicates + * @return the modified query + */ + CriteriaQuery where(Predicate... restrictions); + + /** + * Specify the expressions that are used to form groups over + * the query results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param grouping zero or more grouping expressions + * @return the modified query + */ + CriteriaQuery groupBy(Expression... grouping); + + /** + * Specify the expressions that are used to form groups over + * the query results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param grouping list of zero or more grouping expressions + * @return the modified query + */ + CriteriaQuery groupBy(List> grouping); + + /** + * Specify a restriction over the groups of the query. + * Replaces the previous having restriction(s), if any. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param restriction a simple or compound boolean expression + * @return the modified query + */ + CriteriaQuery having(Expression restriction); + + /** + * Specify restrictions over the groups of the query + * according the conjunction of the specified restriction + * predicates. + * Replaces the previously added having restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param restrictions zero or more restriction predicates + * @return the modified query + */ + CriteriaQuery having(Predicate... restrictions); + + /** + * Specify the ordering expressions that are used to + * order the query results. + * Replaces the previous ordering expressions, if any. + * If no ordering expressions are specified, the previous + * ordering, if any, is simply removed, and results will + * be returned in no particular order. + * The left-to-right sequence of the ordering expressions + * determines the precedence, whereby the leftmost has highest + * precedence. + * @param o zero or more ordering expressions + * @return the modified query + */ + CriteriaQuery orderBy(Order... o); + + /** + * Specify the ordering expressions that are used to + * order the query results. + * Replaces the previous ordering expressions, if any. + * If no ordering expressions are specified, the previous + * ordering, if any, is simply removed, and results will + * be returned in no particular order. + * The order of the ordering expressions in the list + * determines the precedence, whereby the first element in the + * list has highest precedence. + * @param o list of zero or more ordering expressions + * @return the modified query + */ + CriteriaQuery orderBy(List o); + + /** + * Specify whether duplicate query results will be eliminated. + * A true value will cause duplicates to be eliminated. + * A false value will cause duplicates to be retained. + * If distinct has not been specified, duplicate results must + * be retained. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param distinct boolean value specifying whether duplicate + * results must be eliminated from the query result or + * whether they must be retained + * @return the modified query. + */ + CriteriaQuery distinct(boolean distinct); + + /** + * Return the ordering expressions in order of precedence. + * Returns empty list if no ordering expressions have been + * specified. + * Modifications to the list do not affect the query. + * @return the list of ordering expressions + */ + List getOrderList(); + + /** + * Return the parameters of the query. Returns empty set if + * there are no parameters. + * Modifications to the set do not affect the query. + * @return the query parameters + */ + Set> getParameters(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaUpdate.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaUpdate.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/CriteriaUpdate.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2011 - 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 + * + ******************************************************************************/ +package javax.persistence.criteria; + +import javax.persistence.metamodel.SingularAttribute; +import javax.persistence.metamodel.EntityType; + +/** + * The CriteriaUpdate interface defines functionality for performing + * bulk update operations using the Criteria API. + * + *

Criteria API bulk update operations map directly to database update + * operations, bypassing any optimistic locking checks. Portable + * applications using bulk update operations must manually update the + * value of the version column, if desired, and/or manually validate + * the value of the version column. + * The persistence context is not synchronized with the result of the + * bulk update. + * + *

A CriteriaUpdate object must have a single root. + * + * @param the entity type that is the target of the update + * + * @since Java Persistence 2.1 + */ +public interface CriteriaUpdate extends CommonAbstractCriteria { + + /** + * Create and add a query root corresponding to the entity + * that is the target of the update. + * A CriteriaUpdate object has a single root, the entity that + * is being updated. + * @param entityClass the entity class + * @return query root corresponding to the given entity + */ + Root from(Class entityClass); + + /** + * Create and add a query root corresponding to the entity + * that is the target of the update. + * A CriteriaUpdate object has a single root, the entity that + * is being updated. + * @param entity metamodel entity representing the entity + * of type X + * @return query root corresponding to the given entity + */ + Root from(EntityType entity); + + /** + * Return the query root. + * @return the query root + */ + Root getRoot(); + + /** + * Update the value of the specified attribute. + * @param attribute attribute to be updated + * @param value new value + * @return the modified update query + */ + CriteriaUpdate set( SingularAttribute attribute, X value); + + /** + * Update the value of the specified attribute. + * @param attribute attribute to be updated + * @param value new value + * @return the modified update query + */ + CriteriaUpdate set( SingularAttribute attribute, Expression value); + + /** + * Update the value of the specified attribute. + * @param attribute attribute to be updated + * @param value new value + * @return the modified update query + */ + CriteriaUpdate set(Path attribute, X value); + + /** + * Update the value of the specified attribute. + * @param attribute attribute to be updated + * @param value new value + * @return the modified update query + */ + CriteriaUpdate set(Path attribute, Expression value); + + /** + * Update the value of the specified attribute. + * @param attributeName name of the attribute to be updated + * @param value new value + * @return the modified update query + */ + CriteriaUpdate set(String attributeName, Object value); + + /** + * Modify the update query to restrict the target of the update + * according to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * @param restriction a simple or compound boolean expression + * @return the modified update query + */ + CriteriaUpdate where(Expression restriction); + + /** + * Modify the update query to restrict the target of the update + * according to the conjunction of the specified restriction + * predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * @param restrictions zero or more restriction predicates + * @return the modified update query + */ + CriteriaUpdate where(Predicate... restrictions); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/Expression.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/Expression.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/Expression.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,85 @@ +/******************************************************************************* + * 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.criteria; + +import java.util.Collection; + +/** + * Type for query expressions. + * + * @param the type of the expression + * + * @since Java Persistence 2.0 + */ +public interface Expression extends Selection { + + /** + * Create a predicate to test whether the expression is null. + * @return predicate testing whether the expression is null + */ + Predicate isNull(); + + /** + * Create a predicate to test whether the expression is + * not null. + * @return predicate testing whether the expression is not null + */ + Predicate isNotNull(); + + /** + * Create a predicate to test whether the expression is a member + * of the argument list. + * @param values values to be tested against + * @return predicate testing for membership + */ + Predicate in(Object... values); + + /** + * Create a predicate to test whether the expression is a member + * of the argument list. + * @param values expressions to be tested against + * @return predicate testing for membership + */ + Predicate in(Expression... values); + + /** + * Create a predicate to test whether the expression is a member + * of the collection. + * @param values collection of values to be tested against + * @return predicate testing for membership + */ + Predicate in(Collection values); + + /** + * Create a predicate to test whether the expression is a member + * of the collection. + * @param values expression corresponding to collection to be + * tested against + * @return predicate testing for membership + */ + Predicate in(Expression> values); + + /** + * Perform a typecast upon the expression, returning a new + * expression object. + * This method does not cause type conversion: + * the runtime type is not changed. + * Warning: may result in a runtime failure. + * @param type intended type of the expression + * @return new expression of the given type + */ + Expression as(Class type); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/Fetch.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/Fetch.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/Fetch.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,48 @@ +/******************************************************************************* + * 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.criteria; + +import javax.persistence.metamodel.Attribute; + +/** + * Represents a join-fetched association or attribute. + * + * @param the source type of the fetch + * @param the target type of the fetch + * + * @since Java Persistence 2.0 + */ +public interface Fetch extends FetchParent { + + /** + * Return the metamodel attribute corresponding to the + * fetch join. + * @return metamodel attribute for the join + */ + Attribute getAttribute(); + + /** + * Return the parent of the fetched item. + * @return fetch parent + */ + FetchParent getParent(); + + /** + * Return the join type used in the fetch join. + * @return join type + */ + JoinType getJoinType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/FetchParent.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/FetchParent.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/FetchParent.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,102 @@ +/******************************************************************************* + * 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.criteria; + +import javax.persistence.metamodel.PluralAttribute; +import javax.persistence.metamodel.SingularAttribute; + +/** + * Represents an element of the from clause which may + * function as the parent of Fetches. + * + * @param the source type + * @param the target type + * + * @since Java Persistence 2.0 + */ +public interface FetchParent { + + /** + * Return the fetch joins that have been made from this type. + * Returns empty set if no fetch joins have been made from + * this type. + * Modifications to the set do not affect the query. + * @return fetch joins made from this type + */ + java.util.Set> getFetches(); + + /** + * Create a fetch join to the specified single-valued attribute + * using an inner join. + * @param attribute target of the join + * @return the resulting fetch join + */ + Fetch fetch(SingularAttribute attribute); + + /** + * Create a fetch join to the specified single-valued attribute + * using the given join type. + * @param attribute target of the join + * @param jt join type + * @return the resulting fetch join + */ + Fetch fetch(SingularAttribute attribute, JoinType jt); + + /** + * Create a fetch join to the specified collection-valued + * attribute using an inner join. + * @param attribute target of the join + * @return the resulting join + */ + Fetch fetch(PluralAttribute attribute); + + /** + * Create a fetch join to the specified collection-valued + * attribute using the given join type. + * @param attribute target of the join + * @param jt join type + * @return the resulting join + */ + Fetch fetch(PluralAttribute attribute, JoinType jt); + + + //String-based: + + /** + * Create a fetch join to the specified attribute using an + * inner join. + * @param attributeName name of the attribute for the + * target of the join + * @return the resulting fetch join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + @SuppressWarnings("hiding") + Fetch fetch(String attributeName); + + /** + * Create a fetch join to the specified attribute using + * the given join type. + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * @return the resulting fetch join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + @SuppressWarnings("hiding") + Fetch fetch(String attributeName, JoinType jt); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/From.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/From.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/From.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,264 @@ +/******************************************************************************* + * 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.criteria; + +import javax.persistence.metamodel.SingularAttribute; +import javax.persistence.metamodel.CollectionAttribute; +import javax.persistence.metamodel.ListAttribute; +import javax.persistence.metamodel.MapAttribute; +import javax.persistence.metamodel.SetAttribute; +import java.util.Set; + +/** + * Represents a bound type, usually an entity that appears in + * the from clause, but may also be an embeddable belonging to + * an entity in the from clause. + *

Serves as a factory for Joins of associations, embeddables, and + * collections belonging to the type, and for Paths of attributes + * belonging to the type. + * + * @param the source type + * @param the target type + * + * @since Java Persistence 2.0 + */ +@SuppressWarnings("hiding") +public interface From extends Path, FetchParent { + + /** + * Return the joins that have been made from this bound type. + * Returns empty set if no joins have been made from this + * bound type. + * Modifications to the set do not affect the query. + * @return joins made from this type + */ + Set> getJoins(); + + /** + * Whether the From object has been obtained as a result of + * correlation (use of a Subquery correlate + * method). + * @return boolean indicating whether the object has been + * obtained through correlation + */ + boolean isCorrelated(); + + /** + * Returns the parent From object from which the correlated + * From object has been obtained through correlation (use + * of a Subquery correlate method). + * @return the parent of the correlated From object + * @throws IllegalStateException if the From object has + * not been obtained through correlation + */ + From getCorrelationParent(); + + /** + * Create an inner join to the specified single-valued + * attribute. + * @param attribute target of the join + * @return the resulting join + */ + Join join(SingularAttribute attribute); + + /** + * Create a join to the specified single-valued attribute + * using the given join type. + * @param attribute target of the join + * @param jt join type + * @return the resulting join + */ + Join join(SingularAttribute attribute, JoinType jt); + + /** + * Create an inner join to the specified Collection-valued + * attribute. + * @param collection target of the join + * @return the resulting join + */ + CollectionJoin join(CollectionAttribute collection); + + /** + * Create an inner join to the specified Set-valued attribute. + * @param set target of the join + * @return the resulting join + */ + SetJoin join(SetAttribute set); + + /** + * Create an inner join to the specified List-valued attribute. + * @param list target of the join + * @return the resulting join + */ + ListJoin join(ListAttribute list); + + /** + * Create an inner join to the specified Map-valued attribute. + * @param map target of the join + * @return the resulting join + */ + MapJoin join(MapAttribute map); + + /** + * Create a join to the specified Collection-valued attribute + * using the given join type. + * @param collection target of the join + * @param jt join type + * @return the resulting join + */ + CollectionJoin join(CollectionAttribute collection, JoinType jt); + + /** + * Create a join to the specified Set-valued attribute using + * the given join type. + * @param set target of the join + * @param jt join type + * @return the resulting join + */ + SetJoin join(SetAttribute set, JoinType jt); + + /** + * Create a join to the specified List-valued attribute using + * the given join type. + * @param list target of the join + * @param jt join type + * @return the resulting join + */ + ListJoin join(ListAttribute list, JoinType jt); + + /** + * Create a join to the specified Map-valued attribute using + * the given join type. + * @param map target of the join + * @param jt join type + * @return the resulting join + */ + MapJoin join(MapAttribute map, JoinType jt); + + + //String-based: + + /** + * Create an inner join to the specified attribute. + * @param attributeName name of the attribute for the + * target of the join + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + Join join(String attributeName); + + /** + * Create an inner join to the specified Collection-valued + * attribute. + * @param attributeName name of the attribute for the + * target of the join + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + CollectionJoin joinCollection(String attributeName); + + /** + * Create an inner join to the specified Set-valued attribute. + * @param attributeName name of the attribute for the + * target of the join + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + SetJoin joinSet(String attributeName); + + /** + * Create an inner join to the specified List-valued attribute. + * @param attributeName name of the attribute for the + * target of the join + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + ListJoin joinList(String attributeName); + + /** + * Create an inner join to the specified Map-valued attribute. + * @param attributeName name of the attribute for the + * target of the join + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + MapJoin joinMap(String attributeName); + + /** + * Create a join to the specified attribute using the given + * join type. + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + Join join(String attributeName, JoinType jt); + + /** + * Create a join to the specified Collection-valued attribute + * using the given join type. + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + CollectionJoin joinCollection(String attributeName, JoinType jt); + + /** + * Create a join to the specified Set-valued attribute using + * the given join type. + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + SetJoin joinSet(String attributeName, JoinType jt); + + /** + * Create a join to the specified List-valued attribute using + * the given join type. + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + ListJoin joinList(String attributeName, JoinType jt); + + /** + * Create a join to the specified Map-valued attribute using + * the given join type. + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * @return the resulting join + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + MapJoin joinMap(String attributeName, JoinType jt); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/Join.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/Join.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/Join.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,76 @@ +/******************************************************************************* + * 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.criteria; + +import javax.persistence.metamodel.Attribute; + +/** + * A join to an entity, embeddable, or basic type. + * + * @param the source type of the join + * @param the target type of the join + * + * @since Java Persistence 2.0 + */ +public interface Join extends From { + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restriction a simple or compound boolean expression + * @return the modified join object + * @since Java Persistence 2.1 + */ + Join on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restrictions zero or more restriction predicates + * @return the modified join object + * @since Java Persistence 2.1 + */ + Join on(Predicate... restrictions); + + /** + * Return the predicate that corresponds to the ON + * restriction(s) on the join, or null if no ON condition + * has been specified. + * @return the ON restriction predicate + * @since Java Persistence 2.1 + */ + Predicate getOn(); + + /** + * Return the metamodel attribute corresponding to the join. + * @return metamodel attribute corresponding to the join + */ + Attribute getAttribute(); + + /** + * Return the parent of the join. + * @return join parent + */ + From getParent(); + + /** + * Return the join type. + * @return join type + */ + JoinType getJoinType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/JoinType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/JoinType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/JoinType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2017 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.criteria; + +/** + * Defines the three types of joins. + * + * Right outer joins and right outer fetch joins are not required + * to be supported. Applications that use RIGHT join + * types will not be portable. + * + * @since Java Persistence 2.0 + */ +public enum JoinType { + + /** Inner join. */ + INNER, + + /** Left outer join. */ + LEFT, + + /** Right outer join. */ + RIGHT +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/ListJoin.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/ListJoin.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/ListJoin.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,71 @@ +/******************************************************************************* + * 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.criteria; + +import java.util.List; +import javax.persistence.metamodel.ListAttribute; + +/** + * The ListJoin interface is the type of the result of + * joining to a collection over an association or element + * collection that has been specified as a java.util.List. + * + * @param the source type of the join + * @param the element type of the target List + * + * @since Java Persistence 2.0 + */ +public interface ListJoin + extends PluralJoin, E> { + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restriction a simple or compound boolean expression + * @return the modified join object + * @since Java Persistence 2.1 + */ + ListJoin on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restrictions zero or more restriction predicates + * @return the modified join object + * @since Java Persistence 2.1 + */ + ListJoin on(Predicate... restrictions); + + /** + * Return the metamodel representation for the list attribute. + * @return metamodel type representing the List that is + * the target of the join + */ + ListAttribute getModel(); + + /** + * Create an expression that corresponds to the index of + * the object in the referenced association or element + * collection. + * This method must only be invoked upon an object that + * represents an association or element collection for + * which an order column has been defined. + * @return expression denoting the index + */ + Expression index(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/MapJoin.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/MapJoin.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/MapJoin.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,80 @@ +/******************************************************************************* + * 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.criteria; + +import java.util.Map; +import javax.persistence.metamodel.MapAttribute; + +/** + * The MapJoin interface is the type of the result of + * joining to a collection over an association or element + * collection that has been specified as a java.util.Map. + * + * @param the source type of the join + * @param the type of the target Map key + * @param the type of the target Map value + * + * @since Java Persistence 2.0 + */ +public interface MapJoin + extends PluralJoin, V> { + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restriction a simple or compound boolean expression + * @return the modified join object + * @since Java Persistence 2.1 + */ + MapJoin on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restrictions zero or more restriction predicates + * @return the modified join object + * @since Java Persistence 2.1 + */ + MapJoin on(Predicate... restrictions); + + /** + * Return the metamodel representation for the map attribute. + * @return metamodel type representing the Map that is + * the target of the join + */ + MapAttribute getModel(); + + /** + * Create a path expression that corresponds to the map key. + * @return path corresponding to map key + */ + Path key(); + + /** + * Create a path expression that corresponds to the map value. + * This method is for stylistic use only: it just returns this. + * @return path corresponding to the map value + */ + Path value(); + + /** + * Create an expression that corresponds to the map entry. + * @return expression corresponding to the map entry + */ + Expression> entry(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/Order.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/Order.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/Order.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,42 @@ +/******************************************************************************* + * 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.criteria; + +/** + * An object that defines an ordering over the query results. + * + * @since Java Persistence 2.0 + */ +public interface Order { + + /** + * Switch the ordering. + * @return a new Order instance with the reversed ordering + */ + Order reverse(); + + /** + * Whether ascending ordering is in effect. + * @return boolean indicating whether ordering is ascending + */ + boolean isAscending(); + + /** + * Return the expression that is used for ordering. + * @return expression used for ordering + */ + Expression getExpression(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/ParameterExpression.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/ParameterExpression.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/ParameterExpression.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,27 @@ +/******************************************************************************* + * 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.criteria; + +import javax.persistence.Parameter; + +/** + * Type of criteria query parameter expressions. + * + * @param the type of the parameter expression + * + * @since Java Persistence 2.0 + */ +public interface ParameterExpression extends Parameter, Expression {} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/Path.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/Path.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/Path.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,112 @@ +/******************************************************************************* + * 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.criteria; + +import javax.persistence.metamodel.PluralAttribute; +import javax.persistence.metamodel.SingularAttribute; +import javax.persistence.metamodel.Bindable; +import javax.persistence.metamodel.MapAttribute; + +/** + * Represents a simple or compound attribute path from a + * bound type or collection, and is a "primitive" expression. + * + * @param the type referenced by the path + * + * @since Java Persistence 2.0 + */ +public interface Path extends Expression { + + /** + * Return the bindable object that corresponds to the + * path expression. + * @return bindable object corresponding to the path + */ + Bindable getModel(); + + /** + * Return the parent "node" in the path or null if no parent. + * @return parent + */ + Path getParentPath(); + + /** + * Create a path corresponding to the referenced + * single-valued attribute. + * @param attribute single-valued attribute + * @return path corresponding to the referenced attribute + */ + Path get(SingularAttribute attribute); + + /** + * Create a path corresponding to the referenced + * collection-valued attribute. + * @param collection collection-valued attribute + * @return expression corresponding to the referenced attribute + */ + > Expression get(PluralAttribute collection); + + /** + * Create a path corresponding to the referenced + * map-valued attribute. + * @param map map-valued attribute + * @return expression corresponding to the referenced attribute + */ + > Expression get(MapAttribute map); + + /** + * Create an expression corresponding to the type of the path. + * @return expression corresponding to the type of the path + */ + Expression> type(); + + + //String-based: + + /** + * Create a path corresponding to the referenced attribute. + * + *

Note: Applications using the string-based API may need to + * specify the type resulting from the get operation in order + * to avoid the use of Path variables. + * + *

+     *     For example:
+     *
+     *     CriteriaQuery<Person> q = cb.createQuery(Person.class);
+     *     Root<Person> p = q.from(Person.class);
+     *     q.select(p)
+     *      .where(cb.isMember("joe",
+     *                         p.<Set<String>>get("nicknames")));
+     *
+     *     rather than:
+     * 
+     *     CriteriaQuery<Person> q = cb.createQuery(Person.class);
+     *     Root<Person> p = q.from(Person.class);
+     *     Path<Set<String>> nicknames = p.get("nicknames");
+     *     q.select(p)
+     *      .where(cb.isMember("joe", nicknames));
+     *  
+ * + * @param attributeName name of the attribute + * @return path corresponding to the referenced attribute + * @throws IllegalStateException if invoked on a path that + * corresponds to a basic type + * @throws IllegalArgumentException if attribute of the given + * name does not otherwise exist + */ + Path get(String attributeName); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/PluralJoin.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/PluralJoin.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/PluralJoin.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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.criteria; + +import javax.persistence.metamodel.PluralAttribute; + +/** + * The PluralJoin interface defines functionality + * that is common to joins to all collection types. It is + * not intended to be used directly in query construction. + * + * @param the source type + * @param the collection type + * @param the element type of the collection + * + * @since Java Persistence 2.0 + */ +public interface PluralJoin extends Join { + + /** + * Return the metamodel representation for the collection-valued + * attribute corresponding to the join. + * @return metamodel collection-valued attribute corresponding + * to the target of the join + */ + PluralAttribute getModel(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/Predicate.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/Predicate.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/Predicate.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,65 @@ +/******************************************************************************* + * 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.criteria; + +import java.util.List; + +/** + * The type of a simple or compound predicate: a conjunction or + * disjunction of restrictions. + * A simple predicate is considered to be a conjunction with a + * single conjunct. + * + * @since Java Persistence 2.0 + */ +public interface Predicate extends Expression { + + public static enum BooleanOperator { + AND, OR + } + + /** + * Return the boolean operator for the predicate. + * If the predicate is simple, this is AND. + * @return boolean operator for the predicate + */ + BooleanOperator getOperator(); + + /** + * Whether the predicate has been created from another + * predicate by applying the Predicate.not() method + * or the CriteriaBuilder.not() method. + * @return boolean indicating if the predicate is + * a negated predicate + */ + boolean isNegated(); + + /** + * Return the top-level conjuncts or disjuncts of the predicate. + * Returns empty list if there are no top-level conjuncts or + * disjuncts of the predicate. + * Modifications to the list do not affect the query. + * @return list of boolean expressions forming the predicate + */ + List> getExpressions(); + + /** + * Create a negation of the predicate. + * @return negated predicate + */ + Predicate not(); + +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/Root.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/Root.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/Root.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,35 @@ +/******************************************************************************* + * 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.criteria; + +import javax.persistence.metamodel.EntityType; + +/** + * A root type in the from clause. + * Query roots always reference entities. + * + * @param the entity type referenced by the root + * + * @since Java Persistence 2.0 + */ +public interface Root extends From { + + /** + * Return the metamodel entity corresponding to the root. + * @return metamodel entity corresponding to the root + */ + EntityType getModel(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/Selection.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/Selection.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/Selection.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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.criteria; + +import javax.persistence.TupleElement; +import java.util.List; + +/** + * The Selection interface defines an item that is to be + * returned in a query result. + * + * @param the type of the selection item + * + * @since Java Persistence 2.0 + */ +public interface Selection extends TupleElement { + + /** + * Assigns an alias to the selection item. + * Once assigned, an alias cannot be changed or reassigned. + * Returns the same selection item. + * @param name alias + * @return selection item + */ + Selection alias(String name); + + /** + * Whether the selection item is a compound selection. + * @return boolean indicating whether the selection is a compound + * selection + */ + boolean isCompoundSelection(); + + /** + * Return the selection items composing a compound selection. + * Modifications to the list do not affect the query. + * @return list of selection items + * @throws IllegalStateException if selection is not a + * compound selection + */ + List> getCompoundSelectionItems(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/SetJoin.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/SetJoin.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/SetJoin.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,59 @@ +/******************************************************************************* + * 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.criteria; + +import java.util.Set; +import javax.persistence.metamodel.SetAttribute; + +/** + * The SetJoin interface is the type of the result of + * joining to a collection over an association or element + * collection that has been specified as a java.util.Set. + * + * @param the source type of the join + * @param the element type of the target Set + * + * @since Java Persistence 2.0 + */ +public interface SetJoin extends PluralJoin, E> { + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restriction a simple or compound boolean expression + * @return the modified join object + * @since Java Persistence 2.1 + */ + SetJoin on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition and return the join object. + * Replaces the previous ON condition, if any. + * @param restrictions zero or more restriction predicates + * @return the modified join object + * @since Java Persistence 2.1 + */ + SetJoin on(Predicate... restrictions); + + /** + * Return the metamodel representation for the set attribute. + * @return metamodel type representing the Set that is + * the target of the join + */ + SetAttribute getModel(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/Subquery.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/Subquery.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/Subquery.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,212 @@ +/******************************************************************************* + * 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.criteria; + +import java.util.List; +import java.util.Set; + +/** + * The Subquery interface defines functionality that is + * specific to subqueries. + * + * A subquery has an expression as its selection item. + * + * @param the type of the selection item. + * + * @since Java Persistence 2.0 + */ +public interface Subquery extends AbstractQuery, Expression { + + /** + * Specify the item that is to be returned as the subquery + * result. + * Replaces the previously specified selection, if any. + * @param expression expression specifying the item that + * is to be returned as the subquery result + * @return the modified subquery + */ + Subquery select(Expression expression); + + /** + * Modify the subquery to restrict the result according + * to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param restriction a simple or compound boolean expression + * @return the modified subquery + */ + Subquery where(Expression restriction); + + /** + * Modify the subquery to restrict the result according + * to the conjunction of the specified restriction predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param restrictions zero or more restriction predicates + * @return the modified subquery + */ + Subquery where(Predicate... restrictions); + + /** + * Specify the expressions that are used to form groups over + * the subquery results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param grouping zero or more grouping expressions + * @return the modified subquery + */ + Subquery groupBy(Expression... grouping); + + /** + * Specify the expressions that are used to form groups over + * the subquery results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param grouping list of zero or more grouping expressions + * @return the modified subquery + */ + Subquery groupBy(List> grouping); + + /** + * Specify a restriction over the groups of the subquery. + * Replaces the previous having restriction(s), if any. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param restriction a simple or compound boolean expression + * @return the modified subquery + */ + Subquery having(Expression restriction); + + /** + * Specify restrictions over the groups of the subquery + * according the conjunction of the specified restriction + * predicates. + * Replaces the previously added having restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param restrictions zero or more restriction predicates + * @return the modified subquery + */ + Subquery having(Predicate... restrictions); + + /** + * Specify whether duplicate query results will be eliminated. + * A true value will cause duplicates to be eliminated. + * A false value will cause duplicates to be retained. + * If distinct has not been specified, duplicate results must + * be retained. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * @param distinct boolean value specifying whether duplicate + * results must be eliminated from the subquery result or + * whether they must be retained + * @return the modified subquery. + */ + Subquery distinct(boolean distinct); + + /** + * Create a subquery root correlated to a root of the + * enclosing query. + * @param parentRoot a root of the containing query + * @return subquery root + */ + Root correlate(Root parentRoot); + + /** + * Create a subquery join object correlated to a join object + * of the enclosing query. + * @param parentJoin join object of the containing query + * @return subquery join + */ + Join correlate(Join parentJoin); + + /** + * Create a subquery collection join object correlated to a + * collection join object of the enclosing query. + * @param parentCollection join object of the containing query + * @return subquery join + */ + CollectionJoin correlate(CollectionJoin parentCollection); + + /** + * Create a subquery set join object correlated to a set join + * object of the enclosing query. + * @param parentSet join object of the containing query + * @return subquery join + */ + SetJoin correlate(SetJoin parentSet); + + /** + * Create a subquery list join object correlated to a list join + * object of the enclosing query. + * @param parentList join object of the containing query + * @return subquery join + */ + ListJoin correlate(ListJoin parentList); + + /** + * Create a subquery map join object correlated to a map join + * object of the enclosing query. + * @param parentMap join object of the containing query + * @return subquery join + */ + MapJoin correlate(MapJoin parentMap); + + /** + * Return the query of which this is a subquery. + * This must be a CriteriaQuery or a Subquery. + * @return the enclosing query or subquery + */ + AbstractQuery getParent(); + + /** + * Return the query of which this is a subquery. + * This may be a CriteriaQuery, CriteriaUpdate, CriteriaDelete, + * or a Subquery. + * @return the enclosing query or subquery + * @since Java Persistence 2.1 + */ + CommonAbstractCriteria getContainingQuery(); + + /** + * Return the selection expression. + * @return the item to be returned in the subquery result + */ + Expression getSelection(); + + /** + * Return the correlated joins of the subquery. + * Returns empty set if the subquery has no correlated + * joins. + * Modifications to the set do not affect the query. + * @return the correlated joins of the subquery + */ + Set> getCorrelatedJoins(); + +} + Index: 3rdParty_sources/persistence-api/javax/persistence/criteria/package-info.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/criteria/package-info.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/criteria/package-info.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,20 @@ +/******************************************************************************* + * 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 + * + ******************************************************************************/ + +/** + * Java Persistence Criteria API + */ +package javax.persistence.criteria; Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/Attribute.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/Attribute.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/Attribute.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,98 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Represents an attribute of a Java type. + * + * @param The represented type that contains the attribute + * @param The type of the represented attribute + * + * @since Java Persistence 2.0 + */ +public interface Attribute { + + public static enum PersistentAttributeType { + + /** Many-to-one association */ + MANY_TO_ONE, + + /** One-to-one association */ + ONE_TO_ONE, + + /** Basic attribute */ + BASIC, + + /** Embeddable class attribute */ + EMBEDDED, + + /** Many-to-many association */ + MANY_TO_MANY, + + /** One-to-many association */ + ONE_TO_MANY, + + /** Element collection */ + ELEMENT_COLLECTION + } + + /** + * Return the name of the attribute. + * @return name + */ + String getName(); + + /** + * Return the persistent attribute type for the attribute. + * @return persistent attribute type + */ + PersistentAttributeType getPersistentAttributeType(); + + /** + * Return the managed type representing the type in which + * the attribute was declared. + * @return declaring type + */ + ManagedType getDeclaringType(); + + /** + * Return the Java type of the represented attribute. + * @return Java type + */ + Class getJavaType(); + + /** + * Return the java.lang.reflect.Member for the represented + * attribute. + * @return corresponding java.lang.reflect.Member + */ + java.lang.reflect.Member getJavaMember(); + + /** + * Is the attribute an association. + * @return boolean indicating whether the attribute + * corresponds to an association + */ + boolean isAssociation(); + + /** + * Is the attribute collection-valued (represents a Collection, + * Set, List, or Map). + * @return boolean indicating whether the attribute is + * collection-valued + */ + boolean isCollection(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/BasicType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/BasicType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/BasicType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,26 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type BasicType represent basic types (including + * temporal and enumerated types). + * + * @param The type of the represented basic type + * + * @since Java Persistence 2.0 + */ +public interface BasicType extends Type {} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/Bindable.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/Bindable.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/Bindable.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,57 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type Bindable represent object or attribute types + * that can be bound into a {@link javax.persistence.criteria.Path Path}. + * + * @param The type of the represented object or attribute + * + * @since Java Persistence 2.0 + * + */ +public interface Bindable { + + public static enum BindableType { + + /** Single-valued attribute type */ + SINGULAR_ATTRIBUTE, + + /** Multi-valued attribute type */ + PLURAL_ATTRIBUTE, + + /** Entity type */ + ENTITY_TYPE + } + + /** + * Return the bindable type of the represented object. + * @return bindable type + */ + BindableType getBindableType(); + + /** + * Return the Java type of the represented object. + * If the bindable type of the object is PLURAL_ATTRIBUTE, + * the Java element type is returned. If the bindable type is + * SINGULAR_ATTRIBUTE or ENTITY_TYPE, + * the Java type of the + * represented entity or attribute is returned. + * @return Java type + */ + Class getBindableJavaType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/CollectionAttribute.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/CollectionAttribute.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/CollectionAttribute.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type CollectionAttribute represent persistent + * java.util.Collection-valued attributes. + * + * @param The type the represented Collection belongs to + * @param The element type of the represented Collection + * + * @since Java Persistence 2.0 + * + */ +public interface CollectionAttribute + extends PluralAttribute, E> {} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/EmbeddableType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/EmbeddableType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/EmbeddableType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,26 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type EmbeddableType represent embeddable types. + * + * @param The represented type. + * + * @since Java Persistence 2.0 + * + */ +public interface EmbeddableType extends ManagedType {} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/EntityType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/EntityType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/EntityType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type EntityType represent entity types. + * + * @param The represented entity type. + * + * @since Java Persistence 2.0 + * + */ +public interface EntityType + extends IdentifiableType, Bindable{ + + /** + * Return the entity name. + * @return entity name + */ + String getName(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/IdentifiableType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/IdentifiableType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/IdentifiableType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,114 @@ +/******************************************************************************* + * 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.metamodel; + +import java.util.Set; + +/** + * Instances of the type IdentifiableType represent entity or + * mapped superclass types. + * + * @param The represented entity or mapped superclass type. + * + * @since Java Persistence 2.0 + * + */ +public interface IdentifiableType extends ManagedType { + + /** + * Return the attribute that corresponds to the id attribute of + * the entity or mapped superclass. + * @param type the type of the represented id attribute + * @return id attribute + * @throws IllegalArgumentException if id attribute of the given + * type is not present in the identifiable type or if + * the identifiable type has an id class + */ + SingularAttribute getId(Class type); + + /** + * Return the attribute that corresponds to the id attribute + * declared by the entity or mapped superclass. + * @param type the type of the represented declared + * id attribute + * @return declared id attribute + * @throws IllegalArgumentException if id attribute of the given + * type is not declared in the identifiable type or if + * the identifiable type has an id class + */ + SingularAttribute getDeclaredId(Class type); + + /** + * Return the attribute that corresponds to the version + * attribute of the entity or mapped superclass. + * @param type the type of the represented version attribute + * @return version attribute + * @throws IllegalArgumentException if version attribute of the + * given type is not present in the identifiable type + */ + SingularAttribute getVersion(Class type); + + /** + * Return the attribute that corresponds to the version + * attribute declared by the entity or mapped superclass. + * @param type the type of the represented declared version + * attribute + * @return declared version attribute + * @throws IllegalArgumentException if version attribute of the + * type is not declared in the identifiable type + */ + SingularAttribute getDeclaredVersion(Class type); + + /** + * Return the identifiable type that corresponds to the most + * specific mapped superclass or entity extended by the entity + * or mapped superclass. + * @return supertype of identifiable type or null if no + * such supertype + */ + IdentifiableType getSupertype(); + + /** + * Whether the identifiable type has a single id attribute. + * Returns true for a simple id or embedded id; returns false + * for an idclass. + * @return boolean indicating whether the identifiable + * type has a single id attribute + */ + boolean hasSingleIdAttribute(); + + /** + * Whether the identifiable type has a version attribute. + * @return boolean indicating whether the identifiable + * type has a version attribute + */ + boolean hasVersionAttribute(); + + /** + * Return the attributes corresponding to the id class of the + * identifiable type. + * @return id attributes + * @throws IllegalArgumentException if the identifiable type + * does not have an id class + */ + Set> getIdClassAttributes(); + + /** + * Return the type that represents the type of the id. + * @return type of id + */ + Type getIdType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/ListAttribute.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/ListAttribute.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/ListAttribute.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type ListAttribute represent persistent + * javax.util.List-valued attributes. + * + * @param The type the represented List belongs to + * @param The element type of the represented List + * + * @since Java Persistence 2.0 + * + */ +public interface ListAttribute + extends PluralAttribute, E> {} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/ManagedType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/ManagedType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/ManagedType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,339 @@ +/******************************************************************************* + * 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.metamodel; + +import java.util.Set; + +/** + * Instances of the type ManagedType represent entity, mapped + * superclass, and embeddable types. + * + * @param The represented type. + * + * @since Java Persistence 2.0 + * + */ +public interface ManagedType extends Type { + + /** + * Return the attributes of the managed type. + * @return attributes of the managed type + */ + Set> getAttributes(); + + /** + * Return the attributes declared by the managed type. + * Returns empty set if the managed type has no declared + * attributes. + * @return declared attributes of the managed type + */ + Set> getDeclaredAttributes(); + + /** + * Return the single-valued attribute of the managed + * type that corresponds to the specified name and Java type. + * @param name the name of the represented attribute + * @param type the type of the represented attribute + * @return single-valued attribute with given name and type + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + SingularAttribute getSingularAttribute(String name, Class type); + + /** + * Return the single-valued attribute declared by the + * managed type that corresponds to the specified name and + * Java type. + * @param name the name of the represented attribute + * @param type the type of the represented attribute + * @return declared single-valued attribute of the given + * name and type + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + SingularAttribute getDeclaredSingularAttribute(String name, Class type); + + /** + * Return the single-valued attributes of the managed type. + * Returns empty set if the managed type has no single-valued + * attributes. + * @return single-valued attributes + */ + Set> getSingularAttributes(); + + /** + * Return the single-valued attributes declared by the managed + * type. + * Returns empty set if the managed type has no declared + * single-valued attributes. + * @return declared single-valued attributes + */ + Set> getDeclaredSingularAttributes(); + + /** + * Return the Collection-valued attribute of the managed type + * that corresponds to the specified name and Java element type. + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * @return CollectionAttribute of the given name and element + * type + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + CollectionAttribute getCollection(String name, Class elementType); + + /** + * Return the Collection-valued attribute declared by the + * managed type that corresponds to the specified name and Java + * element type. + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * @return declared CollectionAttribute of the given name and + * element type + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + CollectionAttribute getDeclaredCollection(String name, Class elementType); + + /** + * Return the Set-valued attribute of the managed type that + * corresponds to the specified name and Java element type. + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * @return SetAttribute of the given name and element type + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + SetAttribute getSet(String name, Class elementType); + + /** + * Return the Set-valued attribute declared by the managed type + * that corresponds to the specified name and Java element type. + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * @return declared SetAttribute of the given name and + * element type + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + SetAttribute getDeclaredSet(String name, Class elementType); + + /** + * Return the List-valued attribute of the managed type that + * corresponds to the specified name and Java element type. + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * @return ListAttribute of the given name and element type + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + ListAttribute getList(String name, Class elementType); + + /** + * Return the List-valued attribute declared by the managed + * type that corresponds to the specified name and Java + * element type. + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * @return declared ListAttribute of the given name and + * element type + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + ListAttribute getDeclaredList(String name, Class elementType); + + /** + * Return the Map-valued attribute of the managed type that + * corresponds to the specified name and Java key and value + * types. + * @param name the name of the represented attribute + * @param keyType the key type of the represented attribute + * @param valueType the value type of the represented attribute + * @return MapAttribute of the given name and key and value + * types + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + MapAttribute getMap(String name, + Class keyType, + Class valueType); + + /** + * Return the Map-valued attribute declared by the managed + * type that corresponds to the specified name and Java key + * and value types. + * @param name the name of the represented attribute + * @param keyType the key type of the represented attribute + * @param valueType the value type of the represented attribute + * @return declared MapAttribute of the given name and key + * and value types + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + MapAttribute getDeclaredMap(String name, + Class keyType, + Class valueType); + + /** + * Return all multi-valued attributes (Collection-, Set-, + * List-, and Map-valued attributes) of the managed type. + * Returns empty set if the managed type has no multi-valued + * attributes. + * @return Collection-, Set-, List-, and Map-valued attributes + */ + Set> getPluralAttributes(); + + /** + * Return all multi-valued attributes (Collection-, Set-, + * List-, and Map-valued attributes) declared by the + * managed type. + * Returns empty set if the managed type has no declared + * multi-valued attributes. + * @return declared Collection-, Set-, List-, and Map-valued + * attributes + */ + Set> getDeclaredPluralAttributes(); + + +//String-based: + + /** + * Return the attribute of the managed + * type that corresponds to the specified name. + * @param name the name of the represented attribute + * @return attribute with given name + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + Attribute getAttribute(String name); + + /** + * Return the attribute declared by the managed + * type that corresponds to the specified name. + * @param name the name of the represented attribute + * @return attribute with given name + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + Attribute getDeclaredAttribute(String name); + + /** + * Return the single-valued attribute of the managed type that + * corresponds to the specified name. + * @param name the name of the represented attribute + * @return single-valued attribute with the given name + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + SingularAttribute getSingularAttribute(String name); + + /** + * Return the single-valued attribute declared by the managed + * type that corresponds to the specified name. + * @param name the name of the represented attribute + * @return declared single-valued attribute of the given + * name + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + SingularAttribute getDeclaredSingularAttribute(String name); + + /** + * Return the Collection-valued attribute of the managed type + * that corresponds to the specified name. + * @param name the name of the represented attribute + * @return CollectionAttribute of the given name + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + CollectionAttribute getCollection(String name); + + /** + * Return the Collection-valued attribute declared by the + * managed type that corresponds to the specified name. + * @param name the name of the represented attribute + * @return declared CollectionAttribute of the given name + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + CollectionAttribute getDeclaredCollection(String name); + + /** + * Return the Set-valued attribute of the managed type that + * corresponds to the specified name. + * @param name the name of the represented attribute + * @return SetAttribute of the given name + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + SetAttribute getSet(String name); + + /** + * Return the Set-valued attribute declared by the managed type + * that corresponds to the specified name. + * @param name the name of the represented attribute + * @return declared SetAttribute of the given name + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + SetAttribute getDeclaredSet(String name); + + /** + * Return the List-valued attribute of the managed type that + * corresponds to the specified name. + * @param name the name of the represented attribute + * @return ListAttribute of the given name + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + ListAttribute getList(String name); + + /** + * Return the List-valued attribute declared by the managed + * type that corresponds to the specified name. + * @param name the name of the represented attribute + * @return declared ListAttribute of the given name + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + ListAttribute getDeclaredList(String name); + + /** + * Return the Map-valued attribute of the managed type that + * corresponds to the specified name. + * @param name the name of the represented attribute + * @return MapAttribute of the given name + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + MapAttribute getMap(String name); + + /** + * Return the Map-valued attribute declared by the managed + * type that corresponds to the specified name. + * @param name the name of the represented attribute + * @return declared MapAttribute of the given name + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + MapAttribute getDeclaredMap(String name); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/MapAttribute.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/MapAttribute.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/MapAttribute.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -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.metamodel; + +/** + * Instances of the type MapAttribute represent + * persistent java.util.Map-valued attributes. + * + * @param The type the represented Map belongs to + * @param The type of the key of the represented Map + * @param The type of the value of the represented Map + * + * @since Java Persistence 2.0 + * + */ +public interface MapAttribute + extends PluralAttribute, V> { + + /** + * Return the Java type of the map key. + * @return Java key type + */ + Class getKeyJavaType(); + + /** + * Return the type representing the key type of the map. + * @return type representing key type + */ + Type getKeyType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/MappedSuperclassType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/MappedSuperclassType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/MappedSuperclassType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type MappedSuperclassType represent mapped + * superclass types. + * + * @param The represented entity type + * @since Java Persistence 2.0 + */ +public interface MappedSuperclassType extends IdentifiableType {} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/Metamodel.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/Metamodel.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/Metamodel.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,72 @@ +/******************************************************************************* + * 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.metamodel; + +import java.util.Set; + +/** + * Provides access to the metamodel of persistent + * entities in the persistence unit. + * + * @since Java Persistence 2.0 + */ +public interface Metamodel { + + /** + * Return the metamodel entity type representing the entity. + * @param cls the type of the represented entity + * @return the metamodel entity type + * @throws IllegalArgumentException if not an entity + */ + EntityType entity(Class cls); + + /** + * Return the metamodel managed type representing the + * entity, mapped superclass, or embeddable class. + * @param cls the type of the represented managed class + * @return the metamodel managed type + * @throws IllegalArgumentException if not a managed class + */ + ManagedType managedType(Class cls); + + /** + * Return the metamodel embeddable type representing the + * embeddable class. + * @param cls the type of the represented embeddable class + * @return the metamodel embeddable type + * @throws IllegalArgumentException if not an embeddable class + */ + EmbeddableType embeddable(Class cls); + + /** + * Return the metamodel managed types. + * @return the metamodel managed types + */ + Set> getManagedTypes(); + + /** + * Return the metamodel entity types. + * @return the metamodel entity types + */ + Set> getEntities(); + + /** + * Return the metamodel embeddable types. Returns empty set + * if there are no embeddable types. + * @return the metamodel embeddable types + */ + Set> getEmbeddables(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/PluralAttribute.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/PluralAttribute.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/PluralAttribute.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,58 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type PluralAttribute represent + * persistent collection-valued attributes. + * + * @param The type the represented collection belongs to + * @param The type of the represented collection + * @param The element type of the represented collection + * + * @since Java Persistence 2.0 + */ +public interface PluralAttribute + extends Attribute, Bindable { + + public static enum CollectionType { + + /** Collection-valued attribute */ + COLLECTION, + + /** Set-valued attribute */ + SET, + + /** List-valued attribute */ + LIST, + + /** Map-valued attribute */ + MAP + } + + /** + * Return the collection type. + * @return collection type + */ + CollectionType getCollectionType(); + + /** + * Return the type representing the element type of the + * collection. + * @return element type + */ + Type getElementType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/SetAttribute.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/SetAttribute.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/SetAttribute.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type SetAttribute represent + * persistent java.util.Set-valued attributes. + * + * @param The type the represented Set belongs to + * @param The element type of the represented Set + * + * @since Java Persistence 2.0 + */ +public interface SetAttribute + extends PluralAttribute, E> {} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/SingularAttribute.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/SingularAttribute.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/SingularAttribute.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,57 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type SingularAttribute represents persistent + * single-valued properties or fields. + * + * @param The type containing the represented attribute + * @param The type of the represented attribute + * + * @since Java Persistence 2.0 + */ +public interface SingularAttribute + extends Attribute, Bindable { + + /** + * Is the attribute an id attribute. This method will return + * true if the attribute is an attribute that corresponds to + * a simple id, an embedded id, or an attribute of an id class. + * @return boolean indicating whether the attribute is an id + */ + boolean isId(); + + /** + * Is the attribute a version attribute. + * @return boolean indicating whether the attribute is + * a version attribute + */ + boolean isVersion(); + + /** + * Can the attribute be null. + * @return boolean indicating whether the attribute can + * be null + */ + boolean isOptional(); + + /** + * Return the type that represents the type of the attribute. + * @return type of attribute + */ + Type getType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/StaticMetamodel.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/StaticMetamodel.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/StaticMetamodel.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,39 @@ +/******************************************************************************* + * 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.metamodel; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * The StaticMetamodel annotation specifies that the class + * is a metamodel class that represents the entity, mapped + * superclass, or embeddable class designated by the value + * element. + * + * @since Java Persistence 2.0 + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface StaticMetamodel { + + /** + * Class being modelled by the annotated class. + */ + Class value(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/Type.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/Type.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/Type.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,54 @@ +/******************************************************************************* + * 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.metamodel; + +/** + * Instances of the type Type represent persistent object + * or attribute types. + * + * @param The type of the represented object or attribute + * + * @since Java Persistence 2.0 + */ +public interface Type { + + public static enum PersistenceType { + + /** Entity */ + ENTITY, + + /** Embeddable class */ + EMBEDDABLE, + + /** Mapped superclass */ + MAPPED_SUPERCLASS, + + /** Basic type */ + BASIC + } + + /** + * Return the persistence type. + * @return persistence type + */ + PersistenceType getPersistenceType(); + + /** + * Return the represented Java type. + * @return Java type + */ + Class getJavaType(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/metamodel/package-info.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/metamodel/package-info.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/metamodel/package-info.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,20 @@ +/******************************************************************************* + * 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 + * + ******************************************************************************/ + +/** + * Java Persistence Metamodel API + */ +package javax.persistence.metamodel; Index: 3rdParty_sources/persistence-api/javax/persistence/orm_1_0.xsd =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/orm_1_0.xsd (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/orm_1_0.xsd (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,1541 @@ + + + + + + + + + + + @(#)orm_1_0.xsd 1.0 Feb 14 2006 + + + + + + + + + + + + + + + + + + + + + + The entity-mappings element is the root element of an mapping + file. It contains the following four types of elements: + + 1. The persistence-unit-metadata element contains metadata + for the entire persistence unit. It is undefined if this element + occurs in multiple mapping files within the same persistence unit. + + 2. The package, schema, catalog and access elements apply to all of + the entity, mapped-superclass and embeddable elements defined in + the same file in which they occur. + + 3. The sequence-generator, table-generator, named-query, + named-native-query and sql-result-set-mapping elements are global + to the persistence unit. It is undefined to have more than one + sequence-generator or table-generator of the same name in the same + or different mapping files in a persistence unit. It is also + undefined to have more than one named-query or named-native-query + of the same name in the same or different mapping files in a + persistence unit. + + 4. The entity, mapped-superclass and embeddable elements each define + the mapping information for a managed persistent class. The mapping + information contained in these elements may be complete or it may + be partial. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Metadata that applies to the persistence unit and not just to + the mapping file in which it is contained. + + If the xml-mapping-metadata-complete element is specified then + the complete set of mapping metadata for the persistence unit + is contained in the XML mapping files for the persistence unit. + + + + + + + + + + + + + + + + These defaults are applied to the persistence unit as a whole + unless they are overridden by local annotation or XML + element settings. + + schema - Used as the schema for all tables or secondary tables + that apply to the persistence unit + catalog - Used as the catalog for all tables or secondary tables + that apply to the persistence unit + access - Used as the access type for all managed classes in + the persistence unit + cascade-persist - Adds cascade-persist to the set of cascade options + in entity relationships of the persistence unit + entity-listeners - List of default entity listeners to be invoked + on each entity in the persistence unit. + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for an entity. Is allowed to be + sparsely populated and used in conjunction with the annotations. + Alternatively, the metadata-complete attribute can be used to + indicate that no annotations on the entity class (and its fields + or properties) are to be processed. If this is the case then + the defaulting rules for the entity and its subelements will + be recursively applied. + + @Target(TYPE) @Retention(RUNTIME) + public @interface Entity { + String name() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This element contains the entity field or property mappings. + It may be sparsely populated to include only a subset of the + fields or properties. If metadata-complete for the entity is true + then the remainder of the attributes will be defaulted according + to the default rules. + + + + + + + + + + + + + + + + + + + + + + + + + + This element determines how the persistence provider accesses the + state of an entity or embedded object. + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface EntityListeners { + Class[] value(); + } + + + + + + + + + + + + + + + Defines an entity listener to be invoked at lifecycle events + for the entities that list this listener. + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PrePersist {} + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostPersist {} + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PreRemove {} + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostRemove {} + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PreUpdate {} + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostUpdate {} + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostLoad {} + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface QueryHint { + String name(); + String value(); + } + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedQuery { + String name(); + String query(); + QueryHint[] hints() default {}; + } + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedNativeQuery { + String name(); + String query(); + QueryHint[] hints() default {}; + Class resultClass() default void.class; + String resultSetMapping() default ""; //named SqlResultSetMapping + } + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface SqlResultSetMapping { + String name(); + EntityResult[] entities() default {}; + ColumnResult[] columns() default {}; + } + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface EntityResult { + Class entityClass(); + FieldResult[] fields() default {}; + String discriminatorColumn() default ""; + } + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface FieldResult { + String name(); + String column(); + } + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface ColumnResult { + String name(); + } + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Table { + String name() default ""; + String catalog() default ""; + String schema() default ""; + UniqueConstraint[] uniqueConstraints() default {}; + } + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface SecondaryTable { + String name(); + String catalog() default ""; + String schema() default ""; + PrimaryKeyJoinColumn[] pkJoinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + } + + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface UniqueConstraint { + String[] columnNames(); + } + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Column { + String name() default ""; + boolean unique() default false; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + int length() default 255; + int precision() default 0; // decimal precision + int scale() default 0; // decimal scale + } + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface JoinColumn { + String name() default ""; + String referencedColumnName() default ""; + boolean unique() default false; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + } + + + + + + + + + + + + + + + + + + + + public enum GenerationType { TABLE, SEQUENCE, IDENTITY, AUTO }; + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface AttributeOverride { + String name(); + Column column(); + } + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface AssociationOverride { + String name(); + JoinColumn[] joinColumns(); + } + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface IdClass { + Class value(); + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Id {} + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface EmbeddedId {} + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Transient {} + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Version {} + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Basic { + FetchType fetch() default EAGER; + boolean optional() default true; + } + + + + + + + + + + + + + + + + + + + + + + + public enum FetchType { LAZY, EAGER }; + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Lob {} + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Temporal { + TemporalType value(); + } + + + + + + + + + + + + + public enum TemporalType { + DATE, // java.sql.Date + TIME, // java.sql.Time + TIMESTAMP // java.sql.Timestamp + } + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Enumerated { + EnumType value() default ORDINAL; + } + + + + + + + + + + + + + public enum EnumType { + ORDINAL, + STRING + } + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ManyToOne { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default EAGER; + boolean optional() default true; + } + + + + + + + + + + + + + + + + + + + + + + + public enum CascadeType { ALL, PERSIST, MERGE, REMOVE, REFRESH}; + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OneToOne { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default EAGER; + boolean optional() default true; + String mappedBy() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OneToMany { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default LAZY; + String mappedBy() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) + public @interface JoinTable { + String name() default ""; + String catalog() default ""; + String schema() default ""; + JoinColumn[] joinColumns() default {}; + JoinColumn[] inverseJoinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + } + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ManyToMany { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default LAZY; + String mappedBy() default ""; + } + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface GeneratedValue { + GenerationType strategy() default AUTO; + String generator() default ""; + } + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKey { + String name() default ""; + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OrderBy { + String value() default ""; + } + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Inheritance { + InheritanceType strategy() default SINGLE_TABLE; + } + + + + + + + + + + + + + public enum InheritanceType + { SINGLE_TABLE, JOINED, TABLE_PER_CLASS}; + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface DiscriminatorValue { + String value(); + } + + + + + + + + + + + + + public enum DiscriminatorType { STRING, CHAR, INTEGER }; + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface PrimaryKeyJoinColumn { + String name() default ""; + String referencedColumnName() default ""; + String columnDefinition() default ""; + } + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface DiscriminatorColumn { + String name() default "DTYPE"; + DiscriminatorType discriminatorType() default STRING; + String columnDefinition() default ""; + int length() default 31; + } + + + + + + + + + + + + + + + + Defines the settings and mappings for embeddable objects. Is + allowed to be sparsely populated and used in conjunction with + the annotations. Alternatively, the metadata-complete attribute + can be used to indicate that no annotations are to be processed + in the class. If this is the case then the defaulting rules will + be recursively applied. + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Embeddable {} + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Embedded {} + + + + + + + + + + + + + + + + Defines the settings and mappings for a mapped superclass. Is + allowed to be sparsely populated and used in conjunction with + the annotations. Alternatively, the metadata-complete attribute + can be used to indicate that no annotations are to be processed + If this is the case then the defaulting rules will be recursively + applied. + + @Target(TYPE) @Retention(RUNTIME) + public @interface MappedSuperclass{} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface SequenceGenerator { + String name(); + String sequenceName() default ""; + int initialValue() default 1; + int allocationSize() default 50; + } + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface TableGenerator { + String name(); + String table() default ""; + String catalog() default ""; + String schema() default ""; + String pkColumnName() default ""; + String valueColumnName() default ""; + String pkColumnValue() default ""; + int initialValue() default 0; + int allocationSize() default 50; + UniqueConstraint[] uniqueConstraints() default {}; + } + + + + + + + + + + + + + + + + + + + + Index: 3rdParty_sources/persistence-api/javax/persistence/orm_2_0.xsd =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/orm_2_0.xsd (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/orm_2_0.xsd (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,1938 @@ + + + + + + + @(#)orm_2_0.xsd 2.0 October 1 2009 + + + + + + + Copyright (c) 2008, 2009 Sun Microsystems. 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.0, Version 2.0 (October 1, 2009) + Specification available from http://jcp.org/en/jsr/detail?id=317 + + + + + + + ... + + + + ]]> + + + + + + + + + + + + + + + + + + The entity-mappings element is the root element of a mapping + file. It contains the following four types of elements: + + 1. The persistence-unit-metadata element contains metadata + for the entire persistence unit. It is undefined if this element + occurs in multiple mapping files within the same persistence unit. + + 2. The package, schema, catalog and access elements apply to all of + the entity, mapped-superclass and embeddable elements defined in + the same file in which they occur. + + 3. The sequence-generator, table-generator, named-query, + named-native-query and sql-result-set-mapping elements are global + to the persistence unit. It is undefined to have more than one + sequence-generator or table-generator of the same name in the same + or different mapping files in a persistence unit. It is also + undefined to have more than one named-query, named-native-query, or + result-set-mapping of the same name in the same or different mapping + files in a persistence unit. + + 4. The entity, mapped-superclass and embeddable elements each define + the mapping information for a managed persistent class. The mapping + information contained in these elements may be complete or it may + be partial. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Metadata that applies to the persistence unit and not just to + the mapping file in which it is contained. + + If the xml-mapping-metadata-complete element is specified, + the complete set of mapping metadata for the persistence unit + is contained in the XML mapping files for the persistence unit. + + + + + + + + + + + + + + + + + These defaults are applied to the persistence unit as a whole + unless they are overridden by local annotation or XML + element settings. + + schema - Used as the schema for all tables, secondary tables, join + tables, collection tables, sequence generators, and table + generators that apply to the persistence unit + catalog - Used as the catalog for all tables, secondary tables, join + tables, collection tables, sequence generators, and table + generators that apply to the persistence unit + delimited-identifiers - Used to treat database identifiers as + delimited identifiers. + access - Used as the access type for all managed classes in + the persistence unit + cascade-persist - Adds cascade-persist to the set of cascade options + in all entity relationships of the persistence unit + entity-listeners - List of default entity listeners to be invoked + on each entity in the persistence unit. + + + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for an entity. Is allowed to be + sparsely populated and used in conjunction with the annotations. + Alternatively, the metadata-complete attribute can be used to + indicate that no annotations on the entity class (and its fields + or properties) are to be processed. If this is the case then + the defaulting rules for the entity and its subelements will + be recursively applied. + + @Target(TYPE) @Retention(RUNTIME) + public @interface Entity { + String name() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This element determines how the persistence provider accesses the + state of an entity or embedded object. + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface AssociationOverride { + String name(); + JoinColumn[] joinColumns() default{}; + JoinTable joinTable() default @JoinTable; + } + + + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface AttributeOverride { + String name(); + Column column(); + } + + + + + + + + + + + + + + + + + This element contains the entity field or property mappings. + It may be sparsely populated to include only a subset of the + fields or properties. If metadata-complete for the entity is true + then the remainder of the attributes will be defaulted according + to the default rules. + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Basic { + FetchType fetch() default EAGER; + boolean optional() default true; + } + + + + + + + + + + + + + + + + + + + + + + + + public enum CascadeType { ALL, PERSIST, MERGE, REMOVE, REFRESH, DETACH}; + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface CollectionTable { + String name() default ""; + String catalog() default ""; + String schema() default ""; + JoinColumn[] joinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + } + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Column { + String name() default ""; + boolean unique() default false; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + int length() default 255; + int precision() default 0; // decimal precision + int scale() default 0; // decimal scale + } + + + + + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface ColumnResult { + String name(); + } + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface DiscriminatorColumn { + String name() default "DTYPE"; + DiscriminatorType discriminatorType() default STRING; + String columnDefinition() default ""; + int length() default 31; + } + + + + + + + + + + + + + + + + public enum DiscriminatorType { STRING, CHAR, INTEGER }; + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface DiscriminatorValue { + String value(); + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ElementCollection { + Class targetClass() default void.class; + FetchType fetch() default LAZY; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for embeddable objects. Is + allowed to be sparsely populated and used in conjunction with + the annotations. Alternatively, the metadata-complete attribute + can be used to indicate that no annotations are to be processed + in the class. If this is the case then the defaulting rules will + be recursively applied. + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Embeddable {} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Embedded {} + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface EmbeddedId {} + + + + + + + + + + + + + + + + + Defines an entity listener to be invoked at lifecycle events + for the entities that list this listener. + + + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface EntityListeners { + Class[] value(); + } + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface EntityResult { + Class entityClass(); + FieldResult[] fields() default {}; + String discriminatorColumn() default ""; + } + + + + + + + + + + + + + + + + + public enum EnumType { + ORDINAL, + STRING + } + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Enumerated { + EnumType value() default ORDINAL; + } + + + + + + + + + + + + + public enum FetchType { LAZY, EAGER }; + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface FieldResult { + String name(); + String column(); + } + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface GeneratedValue { + GenerationType strategy() default AUTO; + String generator() default ""; + } + + + + + + + + + + + + + + public enum GenerationType { TABLE, SEQUENCE, IDENTITY, AUTO }; + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Id {} + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface IdClass { + Class value(); + } + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Inheritance { + InheritanceType strategy() default SINGLE_TABLE; + } + + + + + + + + + + + + + public enum InheritanceType + { SINGLE_TABLE, JOINED, TABLE_PER_CLASS}; + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface JoinColumn { + String name() default ""; + String referencedColumnName() default ""; + boolean unique() default false; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + } + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface JoinTable { + String name() default ""; + String catalog() default ""; + String schema() default ""; + JoinColumn[] joinColumns() default {}; + JoinColumn[] inverseJoinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + } + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Lob {} + + + + + + + + + + + + public enum LockModeType { READ, WRITE, OPTIMISTIC, OPTIMISTIC_FORCE_INCREMENT, PESSIMISTIC_READ, PESSIMISTIC_WRITE, PESSIMISTIC_FORCE_INCREMENT, NONE}; + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ManyToMany { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default LAZY; + String mappedBy() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ManyToOne { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default EAGER; + boolean optional() default true; + } + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKey { + String name() default ""; + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKeyClass { + Class value(); + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKeyColumn { + String name() default ""; + boolean unique() default false; + boolean nullable() default false; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + int length() default 255; + int precision() default 0; // decimal precision + int scale() default 0; // decimal scale + } + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKeyJoinColumn { + String name() default ""; + String referencedColumnName() default ""; + boolean unique() default false; + boolean nullable() default false; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + } + + + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for a mapped superclass. Is + allowed to be sparsely populated and used in conjunction with + the annotations. Alternatively, the metadata-complete attribute + can be used to indicate that no annotations are to be processed + If this is the case then the defaulting rules will be recursively + applied. + + @Target(TYPE) @Retention(RUNTIME) + public @interface MappedSuperclass{} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedNativeQuery { + String name(); + String query(); + QueryHint[] hints() default {}; + Class resultClass() default void.class; + String resultSetMapping() default ""; //named SqlResultSetMapping + } + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedQuery { + String name(); + String query(); + LockModeType lockMode() default NONE; + QueryHint[] hints() default {}; + } + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OneToMany { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default LAZY; + String mappedBy() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OneToOne { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default EAGER; + boolean optional() default true; + String mappedBy() default ""; + boolean orphanRemoval() default false; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OrderBy { + String value() default ""; + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OrderColumn { + String name() default ""; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + } + + + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostLoad {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostPersist {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostRemove {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostUpdate {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PrePersist {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PreRemove {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PreUpdate {} + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface PrimaryKeyJoinColumn { + String name() default ""; + String referencedColumnName() default ""; + String columnDefinition() default ""; + } + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface QueryHint { + String name(); + String value(); + } + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface SecondaryTable { + String name(); + String catalog() default ""; + String schema() default ""; + PrimaryKeyJoinColumn[] pkJoinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + } + + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface SequenceGenerator { + String name(); + String sequenceName() default ""; + String catalog() default ""; + String schema() default ""; + int initialValue() default 1; + int allocationSize() default 50; + } + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface SqlResultSetMapping { + String name(); + EntityResult[] entities() default {}; + ColumnResult[] columns() default {}; + } + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Table { + String name() default ""; + String catalog() default ""; + String schema() default ""; + UniqueConstraint[] uniqueConstraints() default {}; + } + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface TableGenerator { + String name(); + String table() default ""; + String catalog() default ""; + String schema() default ""; + String pkColumnName() default ""; + String valueColumnName() default ""; + String pkColumnValue() default ""; + int initialValue() default 0; + int allocationSize() default 50; + UniqueConstraint[] uniqueConstraints() default {}; + } + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Temporal { + TemporalType value(); + } + + + + + + + + + + + + + public enum TemporalType { + DATE, // java.sql.Date + TIME, // java.sql.Time + TIMESTAMP // java.sql.Timestamp + } + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Transient {} + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface UniqueConstraint { + String name() default ""; + String[] columnNames(); + } + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Version {} + + + + + + + + + + + + Index: 3rdParty_sources/persistence-api/javax/persistence/orm_2_1.xsd =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/orm_2_1.xsd (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/orm_2_1.xsd (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,2336 @@ + + + + + + + @(#)orm_2_1.xsd 2.1 February 15 2013 + + + + + + + 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, Version 2.1 (February 15, 2013) + Specification available from http://jcp.org/en/jsr/detail?id=338 + + + + + + + ... + + + + ]]> + + + + + + + + + + + + + + + + + + The entity-mappings element is the root element of a mapping + file. It contains the following four types of elements: + + 1. The persistence-unit-metadata element contains metadata + for the entire persistence unit. It is undefined if this element + occurs in multiple mapping files within the same persistence unit. + + 2. The package, schema, catalog and access elements apply to all of + the entity, mapped-superclass and embeddable elements defined in + the same file in which they occur. + + 3. The sequence-generator, table-generator, converter, named-query, + named-native-query, named-stored-procedure-query, and + sql-result-set-mapping elements are global to the persistence + unit. It is undefined to have more than one sequence-generator + or table-generator of the same name in the same or different + mapping files in a persistence unit. It is undefined to have + more than one named-query, named-native-query, sql-result-set-mapping, + or named-stored-procedure-query of the same name in the same + or different mapping files in a persistence unit. It is also + undefined to have more than one converter for the same target + type in the same or different mapping files in a persistence unit. + + 4. The entity, mapped-superclass and embeddable elements each define + the mapping information for a managed persistent class. The mapping + information contained in these elements may be complete or it may + be partial. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Metadata that applies to the persistence unit and not just to + the mapping file in which it is contained. + + If the xml-mapping-metadata-complete element is specified, + the complete set of mapping metadata for the persistence unit + is contained in the XML mapping files for the persistence unit. + + + + + + + + + + + + + + + + + These defaults are applied to the persistence unit as a whole + unless they are overridden by local annotation or XML + element settings. + + schema - Used as the schema for all tables, secondary tables, join + tables, collection tables, sequence generators, and table + generators that apply to the persistence unit + catalog - Used as the catalog for all tables, secondary tables, join + tables, collection tables, sequence generators, and table + generators that apply to the persistence unit + delimited-identifiers - Used to treat database identifiers as + delimited identifiers. + access - Used as the access type for all managed classes in + the persistence unit + cascade-persist - Adds cascade-persist to the set of cascade options + in all entity relationships of the persistence unit + entity-listeners - List of default entity listeners to be invoked + on each entity in the persistence unit. + + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for an entity. Is allowed to be + sparsely populated and used in conjunction with the annotations. + Alternatively, the metadata-complete attribute can be used to + indicate that no annotations on the entity class (and its fields + or properties) are to be processed. If this is the case then + the defaulting rules for the entity and its subelements will + be recursively applied. + + @Target(TYPE) @Retention(RUNTIME) + public @interface Entity { + String name() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This element determines how the persistence provider accesses the + state of an entity or embedded object. + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface AssociationOverride { + String name(); + JoinColumn[] joinColumns() default{}; + JoinTable joinTable() default @JoinTable; + } + + + + + + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface AttributeOverride { + String name(); + Column column(); + } + + + + + + + + + + + + + + + + + This element contains the entity field or property mappings. + It may be sparsely populated to include only a subset of the + fields or properties. If metadata-complete for the entity is true + then the remainder of the attributes will be defaulted according + to the default rules. + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Basic { + FetchType fetch() default EAGER; + boolean optional() default true; + } + + + + + + + + + + + + + + + + + + + + + + + + + public enum CascadeType { ALL, PERSIST, MERGE, REMOVE, REFRESH, DETACH}; + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface CollectionTable { + String name() default ""; + String catalog() default ""; + String schema() default ""; + JoinColumn[] joinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + Index[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Column { + String name() default ""; + boolean unique() default false; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + int length() default 255; + int precision() default 0; // decimal precision + int scale() default 0; // decimal scale + } + + + + + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface ColumnResult { + String name(); + Class type() default void.class; + } + + + + + + + + + + + + + + public enum ConstraintMode {CONSTRAINT, NO_CONSTRAINT, PROVIDER_DEFAULT}; + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface ConstructorResult { + Class targetClass(); + ColumnResult[] columns(); + } + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface Convert { + Class converter() default void.class; + String attributeName() default ""; + boolean disableConversion() default false; + } + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface Converter { + boolean autoApply() default false; + } + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface DiscriminatorColumn { + String name() default "DTYPE"; + DiscriminatorType discriminatorType() default STRING; + String columnDefinition() default ""; + int length() default 31; + } + + + + + + + + + + + + + + + + public enum DiscriminatorType { STRING, CHAR, INTEGER }; + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface DiscriminatorValue { + String value(); + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ElementCollection { + Class targetClass() default void.class; + FetchType fetch() default LAZY; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for embeddable objects. Is + allowed to be sparsely populated and used in conjunction with + the annotations. Alternatively, the metadata-complete attribute + can be used to indicate that no annotations are to be processed + in the class. If this is the case then the defaulting rules will + be recursively applied. + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Embeddable {} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Embedded {} + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface EmbeddedId {} + + + + + + + + + + + + + + + + + Defines an entity listener to be invoked at lifecycle events + for the entities that list this listener. + + + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface EntityListeners { + Class[] value(); + } + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface EntityResult { + Class entityClass(); + FieldResult[] fields() default {}; + String discriminatorColumn() default ""; + } + + + + + + + + + + + + + + + + + public enum EnumType { + ORDINAL, + STRING + } + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Enumerated { + EnumType value() default ORDINAL; + } + + + + + + + + + + + + + public enum FetchType { LAZY, EAGER }; + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface FieldResult { + String name(); + String column(); + } + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface ForeignKey { + String name() default ""; + ConstraintMode value() default CONSTRAINT; + String foreign-key-definition() default ""; + + Note that the elements that embed the use of the annotation + default this use as @ForeignKey(PROVIDER_DEFAULT). + + } + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface GeneratedValue { + GenerationType strategy() default AUTO; + String generator() default ""; + } + + + + + + + + + + + + + + public enum GenerationType { TABLE, SEQUENCE, IDENTITY, AUTO }; + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Id {} + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface IdClass { + Class value(); + } + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface Index { + String name() default ""; + String columnList(); + boolean unique() default false; + } + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Inheritance { + InheritanceType strategy() default SINGLE_TABLE; + } + + + + + + + + + + + + + public enum InheritanceType + { SINGLE_TABLE, JOINED, TABLE_PER_CLASS}; + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface JoinColumn { + String name() default ""; + String referencedColumnName() default ""; + boolean unique() default false; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + ForeignKey foreignKey() default @ForeignKey(); + } + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface JoinTable { + String name() default ""; + String catalog() default ""; + String schema() default ""; + JoinColumn[] joinColumns() default {}; + JoinColumn[] inverseJoinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + Index[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Lob {} + + + + + + + + + + + + public enum LockModeType { READ, WRITE, OPTIMISTIC, OPTIMISTIC_FORCE_INCREMENT, PESSIMISTIC_READ, PESSIMISTIC_WRITE, PESSIMISTIC_FORCE_INCREMENT, NONE}; + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ManyToMany { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default LAZY; + String mappedBy() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ManyToOne { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default EAGER; + boolean optional() default true; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKey { + String name() default ""; + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKeyClass { + Class value(); + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKeyColumn { + String name() default ""; + boolean unique() default false; + boolean nullable() default false; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + int length() default 255; + int precision() default 0; // decimal precision + int scale() default 0; // decimal scale + } + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKeyJoinColumn { + String name() default ""; + String referencedColumnName() default ""; + boolean unique() default false; + boolean nullable() default false; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + } + + + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for a mapped superclass. Is + allowed to be sparsely populated and used in conjunction with + the annotations. Alternatively, the metadata-complete attribute + can be used to indicate that no annotations are to be processed + If this is the case then the defaulting rules will be recursively + applied. + + @Target(TYPE) @Retention(RUNTIME) + public @interface MappedSuperclass{} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface NamedAttributeNode { + String value(); + String subgraph() default ""; + String keySubgraph() default ""; + } + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedEntityGraph { + String name() default ""; + NamedAttributeNode[] attributeNodes() default {}; + boolean includeAllAttributes() default false; + NamedSubgraph[] subgraphs() default {}; + NamedSubGraph[] subclassSubgraphs() default {}; + } + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedNativeQuery { + String name(); + String query(); + QueryHint[] hints() default {}; + Class resultClass() default void.class; + String resultSetMapping() default ""; //named SqlResultSetMapping + } + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedQuery { + String name(); + String query(); + LockModeType lockMode() default NONE; + QueryHint[] hints() default {}; + } + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedStoredProcedureQuery { + String name(); + String procedureName(); + StoredProcedureParameter[] parameters() default {}; + Class[] resultClasses() default {}; + String[] resultSetMappings() default{}; + QueryHint[] hints() default {}; + } + + + + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface NamedSubgraph { + String name(); + Class type() default void.class; + NamedAttributeNode[] attributeNodes(); + } + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OneToMany { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default LAZY; + String mappedBy() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OneToOne { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default EAGER; + boolean optional() default true; + String mappedBy() default ""; + boolean orphanRemoval() default false; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OrderBy { + String value() default ""; + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OrderColumn { + String name() default ""; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + } + + + + + + + + + + + + + + + + + public enum ParameterMode { IN, INOUT, OUT, REF_CURSOR}; + + + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostLoad {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostPersist {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostRemove {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostUpdate {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PrePersist {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PreRemove {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PreUpdate {} + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface PrimaryKeyJoinColumn { + String name() default ""; + String referencedColumnName() default ""; + String columnDefinition() default ""; + } + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface QueryHint { + String name(); + String value(); + } + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface SecondaryTable { + String name(); + String catalog() default ""; + String schema() default ""; + PrimaryKeyJoinColumn[] pkJoinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + Index[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface SequenceGenerator { + String name(); + String sequenceName() default ""; + String catalog() default ""; + String schema() default ""; + int initialValue() default 1; + int allocationSize() default 50; + } + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface SqlResultSetMapping { + String name(); + EntityResult[] entities() default {}; + ConstructorResult[] classes() default{}; + ColumnResult[] columns() default {}; + } + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface StoredProcedureParameter { + String name() default ""; + ParameterMode mode() default ParameterMode.IN; + Class type(); + } + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Table { + String name() default ""; + String catalog() default ""; + String schema() default ""; + UniqueConstraint[] uniqueConstraints() default {}; + Index[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface TableGenerator { + String name(); + String table() default ""; + String catalog() default ""; + String schema() default ""; + String pkColumnName() default ""; + String valueColumnName() default ""; + String pkColumnValue() default ""; + int initialValue() default 0; + int allocationSize() default 50; + UniqueConstraint[] uniqueConstraints() default {}; + Indexes[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Temporal { + TemporalType value(); + } + + + + + + + + + + + + + public enum TemporalType { + DATE, // java.sql.Date + TIME, // java.sql.Time + TIMESTAMP // java.sql.Timestamp + } + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Transient {} + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface UniqueConstraint { + String name() default ""; + String[] columnNames(); + } + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Version {} + + + + + + + + + + + + Index: 3rdParty_sources/persistence-api/javax/persistence/orm_2_2.xsd =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/orm_2_2.xsd (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/orm_2_2.xsd (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,2336 @@ + + + + + + + @(#)orm_2_2.xsd 2.2 July 7 2017 + + + + + + + Copyright (c) 2008 - 2017 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.2, Version 2.2 (July 7, 2017) + Specification available from http://jcp.org/en/jsr/detail?id=338 + + + + + + + ... + + + + ]]> + + + + + + + + + + + + + + + + + + The entity-mappings element is the root element of a mapping + file. It contains the following four types of elements: + + 1. The persistence-unit-metadata element contains metadata + for the entire persistence unit. It is undefined if this element + occurs in multiple mapping files within the same persistence unit. + + 2. The package, schema, catalog and access elements apply to all of + the entity, mapped-superclass and embeddable elements defined in + the same file in which they occur. + + 3. The sequence-generator, table-generator, converter, named-query, + named-native-query, named-stored-procedure-query, and + sql-result-set-mapping elements are global to the persistence + unit. It is undefined to have more than one sequence-generator + or table-generator of the same name in the same or different + mapping files in a persistence unit. It is undefined to have + more than one named-query, named-native-query, sql-result-set-mapping, + or named-stored-procedure-query of the same name in the same + or different mapping files in a persistence unit. It is also + undefined to have more than one converter for the same target + type in the same or different mapping files in a persistence unit. + + 4. The entity, mapped-superclass and embeddable elements each define + the mapping information for a managed persistent class. The mapping + information contained in these elements may be complete or it may + be partial. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Metadata that applies to the persistence unit and not just to + the mapping file in which it is contained. + + If the xml-mapping-metadata-complete element is specified, + the complete set of mapping metadata for the persistence unit + is contained in the XML mapping files for the persistence unit. + + + + + + + + + + + + + + + + + These defaults are applied to the persistence unit as a whole + unless they are overridden by local annotation or XML + element settings. + + schema - Used as the schema for all tables, secondary tables, join + tables, collection tables, sequence generators, and table + generators that apply to the persistence unit + catalog - Used as the catalog for all tables, secondary tables, join + tables, collection tables, sequence generators, and table + generators that apply to the persistence unit + delimited-identifiers - Used to treat database identifiers as + delimited identifiers. + access - Used as the access type for all managed classes in + the persistence unit + cascade-persist - Adds cascade-persist to the set of cascade options + in all entity relationships of the persistence unit + entity-listeners - List of default entity listeners to be invoked + on each entity in the persistence unit. + + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for an entity. Is allowed to be + sparsely populated and used in conjunction with the annotations. + Alternatively, the metadata-complete attribute can be used to + indicate that no annotations on the entity class (and its fields + or properties) are to be processed. If this is the case then + the defaulting rules for the entity and its subelements will + be recursively applied. + + @Target(TYPE) @Retention(RUNTIME) + public @interface Entity { + String name() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This element determines how the persistence provider accesses the + state of an entity or embedded object. + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface AssociationOverride { + String name(); + JoinColumn[] joinColumns() default{}; + JoinTable joinTable() default @JoinTable; + } + + + + + + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface AttributeOverride { + String name(); + Column column(); + } + + + + + + + + + + + + + + + + + This element contains the entity field or property mappings. + It may be sparsely populated to include only a subset of the + fields or properties. If metadata-complete for the entity is true + then the remainder of the attributes will be defaulted according + to the default rules. + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Basic { + FetchType fetch() default EAGER; + boolean optional() default true; + } + + + + + + + + + + + + + + + + + + + + + + + + + public enum CascadeType { ALL, PERSIST, MERGE, REMOVE, REFRESH, DETACH}; + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface CollectionTable { + String name() default ""; + String catalog() default ""; + String schema() default ""; + JoinColumn[] joinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + Index[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Column { + String name() default ""; + boolean unique() default false; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + int length() default 255; + int precision() default 0; // decimal precision + int scale() default 0; // decimal scale + } + + + + + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface ColumnResult { + String name(); + Class type() default void.class; + } + + + + + + + + + + + + + + public enum ConstraintMode {CONSTRAINT, NO_CONSTRAINT, PROVIDER_DEFAULT}; + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface ConstructorResult { + Class targetClass(); + ColumnResult[] columns(); + } + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface Convert { + Class converter() default void.class; + String attributeName() default ""; + boolean disableConversion() default false; + } + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface Converter { + boolean autoApply() default false; + } + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface DiscriminatorColumn { + String name() default "DTYPE"; + DiscriminatorType discriminatorType() default STRING; + String columnDefinition() default ""; + int length() default 31; + } + + + + + + + + + + + + + + + + public enum DiscriminatorType { STRING, CHAR, INTEGER }; + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface DiscriminatorValue { + String value(); + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ElementCollection { + Class targetClass() default void.class; + FetchType fetch() default LAZY; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for embeddable objects. Is + allowed to be sparsely populated and used in conjunction with + the annotations. Alternatively, the metadata-complete attribute + can be used to indicate that no annotations are to be processed + in the class. If this is the case then the defaulting rules will + be recursively applied. + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Embeddable {} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Embedded {} + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface EmbeddedId {} + + + + + + + + + + + + + + + + + Defines an entity listener to be invoked at lifecycle events + for the entities that list this listener. + + + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface EntityListeners { + Class[] value(); + } + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface EntityResult { + Class entityClass(); + FieldResult[] fields() default {}; + String discriminatorColumn() default ""; + } + + + + + + + + + + + + + + + + + public enum EnumType { + ORDINAL, + STRING + } + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Enumerated { + EnumType value() default ORDINAL; + } + + + + + + + + + + + + + public enum FetchType { LAZY, EAGER }; + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface FieldResult { + String name(); + String column(); + } + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface ForeignKey { + String name() default ""; + ConstraintMode value() default CONSTRAINT; + String foreign-key-definition() default ""; + + Note that the elements that embed the use of the annotation + default this use as @ForeignKey(PROVIDER_DEFAULT). + + } + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface GeneratedValue { + GenerationType strategy() default AUTO; + String generator() default ""; + } + + + + + + + + + + + + + + public enum GenerationType { TABLE, SEQUENCE, IDENTITY, AUTO }; + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Id {} + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface IdClass { + Class value(); + } + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface Index { + String name() default ""; + String columnList(); + boolean unique() default false; + } + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Inheritance { + InheritanceType strategy() default SINGLE_TABLE; + } + + + + + + + + + + + + + public enum InheritanceType + { SINGLE_TABLE, JOINED, TABLE_PER_CLASS}; + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface JoinColumn { + String name() default ""; + String referencedColumnName() default ""; + boolean unique() default false; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + ForeignKey foreignKey() default @ForeignKey(); + } + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface JoinTable { + String name() default ""; + String catalog() default ""; + String schema() default ""; + JoinColumn[] joinColumns() default {}; + JoinColumn[] inverseJoinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + Index[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Lob {} + + + + + + + + + + + + public enum LockModeType { READ, WRITE, OPTIMISTIC, OPTIMISTIC_FORCE_INCREMENT, PESSIMISTIC_READ, PESSIMISTIC_WRITE, PESSIMISTIC_FORCE_INCREMENT, NONE}; + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ManyToMany { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default LAZY; + String mappedBy() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface ManyToOne { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default EAGER; + boolean optional() default true; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKey { + String name() default ""; + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKeyClass { + Class value(); + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKeyColumn { + String name() default ""; + boolean unique() default false; + boolean nullable() default false; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + int length() default 255; + int precision() default 0; // decimal precision + int scale() default 0; // decimal scale + } + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface MapKeyJoinColumn { + String name() default ""; + String referencedColumnName() default ""; + boolean unique() default false; + boolean nullable() default false; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + String table() default ""; + } + + + + + + + + + + + + + + + + + + + + + Defines the settings and mappings for a mapped superclass. Is + allowed to be sparsely populated and used in conjunction with + the annotations. Alternatively, the metadata-complete attribute + can be used to indicate that no annotations are to be processed + If this is the case then the defaulting rules will be recursively + applied. + + @Target(TYPE) @Retention(RUNTIME) + public @interface MappedSuperclass{} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface NamedAttributeNode { + String value(); + String subgraph() default ""; + String keySubgraph() default ""; + } + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedEntityGraph { + String name() default ""; + NamedAttributeNode[] attributeNodes() default {}; + boolean includeAllAttributes() default false; + NamedSubgraph[] subgraphs() default {}; + NamedSubGraph[] subclassSubgraphs() default {}; + } + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedNativeQuery { + String name(); + String query(); + QueryHint[] hints() default {}; + Class resultClass() default void.class; + String resultSetMapping() default ""; //named SqlResultSetMapping + } + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedQuery { + String name(); + String query(); + LockModeType lockMode() default NONE; + QueryHint[] hints() default {}; + } + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface NamedStoredProcedureQuery { + String name(); + String procedureName(); + StoredProcedureParameter[] parameters() default {}; + Class[] resultClasses() default {}; + String[] resultSetMappings() default{}; + QueryHint[] hints() default {}; + } + + + + + + + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface NamedSubgraph { + String name(); + Class type() default void.class; + NamedAttributeNode[] attributeNodes(); + } + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OneToMany { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default LAZY; + String mappedBy() default ""; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OneToOne { + Class targetEntity() default void.class; + CascadeType[] cascade() default {}; + FetchType fetch() default EAGER; + boolean optional() default true; + String mappedBy() default ""; + boolean orphanRemoval() default false; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OrderBy { + String value() default ""; + } + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface OrderColumn { + String name() default ""; + boolean nullable() default true; + boolean insertable() default true; + boolean updatable() default true; + String columnDefinition() default ""; + } + + + + + + + + + + + + + + + + + public enum ParameterMode { IN, INOUT, OUT, REF_CURSOR}; + + + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostLoad {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostPersist {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostRemove {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PostUpdate {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PrePersist {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PreRemove {} + + + + + + + + + + + + + + + + @Target({METHOD}) @Retention(RUNTIME) + public @interface PreUpdate {} + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface PrimaryKeyJoinColumn { + String name() default ""; + String referencedColumnName() default ""; + String columnDefinition() default ""; + } + + + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface QueryHint { + String name(); + String value(); + } + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface SecondaryTable { + String name(); + String catalog() default ""; + String schema() default ""; + PrimaryKeyJoinColumn[] pkJoinColumns() default {}; + UniqueConstraint[] uniqueConstraints() default {}; + Index[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface SequenceGenerator { + String name(); + String sequenceName() default ""; + String catalog() default ""; + String schema() default ""; + int initialValue() default 1; + int allocationSize() default 50; + } + + + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface SqlResultSetMapping { + String name(); + EntityResult[] entities() default {}; + ConstructorResult[] classes() default{}; + ColumnResult[] columns() default {}; + } + + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface StoredProcedureParameter { + String name() default ""; + ParameterMode mode() default ParameterMode.IN; + Class type(); + } + + + + + + + + + + + + + + + + + + @Target({TYPE}) @Retention(RUNTIME) + public @interface Table { + String name() default ""; + String catalog() default ""; + String schema() default ""; + UniqueConstraint[] uniqueConstraints() default {}; + Index[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) + public @interface TableGenerator { + String name(); + String table() default ""; + String catalog() default ""; + String schema() default ""; + String pkColumnName() default ""; + String valueColumnName() default ""; + String pkColumnValue() default ""; + int initialValue() default 0; + int allocationSize() default 50; + UniqueConstraint[] uniqueConstraints() default {}; + Indexes[] indexes() default {}; + } + + + + + + + + + + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Temporal { + TemporalType value(); + } + + + + + + + + + + + + + public enum TemporalType { + DATE, // java.sql.Date + TIME, // java.sql.Time + TIMESTAMP // java.sql.Timestamp + } + + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Transient {} + + + + + + + + + + + + + @Target({}) @Retention(RUNTIME) + public @interface UniqueConstraint { + String name() default ""; + String[] columnNames(); + } + + + + + + + + + + + + + + + + @Target({METHOD, FIELD}) @Retention(RUNTIME) + public @interface Version {} + + + + + + + + + + + + Index: 3rdParty_sources/persistence-api/javax/persistence/package-info.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/package-info.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/package-info.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,20 @@ +/******************************************************************************* + * 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 + * + ******************************************************************************/ + +/** + * Java Persistence is the API for the management for persistence and object/relational mapping. + */ +package javax.persistence; Index: 3rdParty_sources/persistence-api/javax/persistence/persistence_1_0.xsd =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/persistence_1_0.xsd (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/persistence_1_0.xsd (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,284 @@ + + + + + + + + + + + @(#)persistence_1_0.xsd 1.0 Feb 9 2006 + + + + + ... + + + ]]> + + + + + + + + + + + + + + + + + + + + + + Configuration of a persistence unit. + + + + + + + + + + + + Textual description of this persistence unit. + + + + + + + + + + + + Provider class that supplies EntityManagers for this + persistence unit. + + + + + + + + + + + + The container-specific name of the JTA datasource to use. + + + + + + + + + + + + The container-specific name of a non-JTA datasource to use. + + + + + + + + + + + + File containing mapping information. Loaded as a resource + by the persistence provider. + + + + + + + + + + + + Jar file that should be scanned for entities. + Not applicable to Java SE persistence units. + + + + + + + + + + + + Class to scan for annotations. It should be annotated + with either @Entity, @Embeddable or @MappedSuperclass. + + + + + + + + + + + + When set to true then only listed classes and jars will + be scanned for persistent classes, otherwise the enclosing + jar or directory will also be scanned. Not applicable to + Java SE persistence units. + + + + + + + + + + + + A list of vendor-specific properties. + + + + + + + + + A name-value pair. + + + + + + + + + + + + + + + + + + + + Name used in code to reference this persistence unit. + + + + + + + + + + + + Type of transactions used by EntityManagers from this + persistence unit. + + + + + + + + + + + + + + + + + + + public enum TransactionType { JTA, RESOURCE_LOCAL }; + + + + + + + + + + Index: 3rdParty_sources/persistence-api/javax/persistence/persistence_2_0.xsd =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/persistence_2_0.xsd (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/persistence_2_0.xsd (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,354 @@ + + + + + + + @(#)persistence_2_0.xsd 1.0 October 1 2009 + + + + + + + Copyright (c) 2008, 2009 Sun Microsystems. 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.0, Version 2.0 (October 1, 2009) + Specification available from http://jcp.org/en/jsr/detail?id=317 + + + + + + + ... + + + ]]> + + + + + + + + + + + + + + + + + + + + + + Configuration of a persistence unit. + + + + + + + + + + + + Description of this persistence unit. + + + + + + + + + + + + Provider class that supplies EntityManagers for this + persistence unit. + + + + + + + + + + + + The container-specific name of the JTA datasource to use. + + + + + + + + + + + + The container-specific name of a non-JTA datasource to use. + + + + + + + + + + + + File containing mapping information. Loaded as a resource + by the persistence provider. + + + + + + + + + + + + Jar file that is to be scanned for managed classes. + + + + + + + + + + + + Managed class to be included in the persistence unit and + to scan for annotations. It should be annotated + with either @Entity, @Embeddable or @MappedSuperclass. + + + + + + + + + + + + When set to true then only listed classes and jars will + be scanned for persistent classes, otherwise the + enclosing jar or directory will also be scanned. + Not applicable to Java SE persistence units. + + + + + + + + + + + + Defines whether caching is enabled for the + persistence unit if caching is supported by the + persistence provider. When set to ALL, all entities + will be cached. When set to NONE, no entities will + be cached. When set to ENABLE_SELECTIVE, only entities + specified as cacheable will be cached. When set to + DISABLE_SELECTIVE, entities specified as not cacheable + will not be cached. When not specified or when set to + UNSPECIFIED, provider defaults may apply. + + + + + + + + + + + + The validation mode to be used for the persistence unit. + + + + + + + + + + + + + A list of standard and vendor-specific properties + and hints. + + + + + + + + + A name-value pair. + + + + + + + + + + + + + + + + + + + + Name used in code to reference this persistence unit. + + + + + + + + + + + + Type of transactions used by EntityManagers from this + persistence unit. + + + + + + + + + + + + + + + + + + + public enum PersistenceUnitTransactionType {JTA, RESOURCE_LOCAL}; + + + + + + + + + + + + + + + + public enum SharedCacheMode { ALL, NONE, ENABLE_SELECTIVE, DISABLE_SELECTIVE, UNSPECIFIED}; + + + + + + + + + + + + + + + + + + + public enum ValidationMode { AUTO, CALLBACK, NONE}; + + + + + + + + + + + Index: 3rdParty_sources/persistence-api/javax/persistence/persistence_2_1.xsd =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/persistence_2_1.xsd (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/persistence_2_1.xsd (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,354 @@ + + + + + + + @(#)persistence_2_1.xsd 2.1 February 4, 2013 + + + + + + + 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, Version 2.1 (February 4, 2013) + Specification available from http://jcp.org/en/jsr/detail?id=338 + + + + + + + ... + + + ]]> + + + + + + + + + + + + + + + + + + + + + + Configuration of a persistence unit. + + + + + + + + + + + + Description of this persistence unit. + + + + + + + + + + + + Provider class that supplies EntityManagers for this + persistence unit. + + + + + + + + + + + + The container-specific name of the JTA datasource to use. + + + + + + + + + + + + The container-specific name of a non-JTA datasource to use. + + + + + + + + + + + + File containing mapping information. Loaded as a resource + by the persistence provider. + + + + + + + + + + + + Jar file that is to be scanned for managed classes. + + + + + + + + + + + + Managed class to be included in the persistence unit and + to scan for annotations. It should be annotated + with either @Entity, @Embeddable or @MappedSuperclass. + + + + + + + + + + + + When set to true then only listed classes and jars will + be scanned for persistent classes, otherwise the + enclosing jar or directory will also be scanned. + Not applicable to Java SE persistence units. + + + + + + + + + + + + Defines whether caching is enabled for the + persistence unit if caching is supported by the + persistence provider. When set to ALL, all entities + will be cached. When set to NONE, no entities will + be cached. When set to ENABLE_SELECTIVE, only entities + specified as cacheable will be cached. When set to + DISABLE_SELECTIVE, entities specified as not cacheable + will not be cached. When not specified or when set to + UNSPECIFIED, provider defaults may apply. + + + + + + + + + + + + The validation mode to be used for the persistence unit. + + + + + + + + + + + + + A list of standard and vendor-specific properties + and hints. + + + + + + + + + A name-value pair. + + + + + + + + + + + + + + + + + + + + Name used in code to reference this persistence unit. + + + + + + + + + + + + Type of transactions used by EntityManagers from this + persistence unit. + + + + + + + + + + + + + + + + + + + public enum PersistenceUnitTransactionType {JTA, RESOURCE_LOCAL}; + + + + + + + + + + + + + + + + public enum SharedCacheMode { ALL, NONE, ENABLE_SELECTIVE, DISABLE_SELECTIVE, UNSPECIFIED}; + + + + + + + + + + + + + + + + + + + public enum ValidationMode { AUTO, CALLBACK, NONE}; + + + + + + + + + + + Index: 3rdParty_sources/persistence-api/javax/persistence/persistence_2_2.xsd =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/persistence_2_2.xsd (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/persistence_2_2.xsd (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,354 @@ + + + + + + + @(#)persistence_2_2.xsd 2.2 July 17, 2017 + + + + + + + Copyright (c) 2008 - 2017 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.2, Version 2.2 (July 7, 2017) + Specification available from http://jcp.org/en/jsr/detail?id=338 + + + + + + + ... + + + ]]> + + + + + + + + + + + + + + + + + + + + + + Configuration of a persistence unit. + + + + + + + + + + + + Description of this persistence unit. + + + + + + + + + + + + Provider class that supplies EntityManagers for this + persistence unit. + + + + + + + + + + + + The container-specific name of the JTA datasource to use. + + + + + + + + + + + + The container-specific name of a non-JTA datasource to use. + + + + + + + + + + + + File containing mapping information. Loaded as a resource + by the persistence provider. + + + + + + + + + + + + Jar file that is to be scanned for managed classes. + + + + + + + + + + + + Managed class to be included in the persistence unit and + to scan for annotations. It should be annotated + with either @Entity, @Embeddable or @MappedSuperclass. + + + + + + + + + + + + When set to true then only listed classes and jars will + be scanned for persistent classes, otherwise the + enclosing jar or directory will also be scanned. + Not applicable to Java SE persistence units. + + + + + + + + + + + + Defines whether caching is enabled for the + persistence unit if caching is supported by the + persistence provider. When set to ALL, all entities + will be cached. When set to NONE, no entities will + be cached. When set to ENABLE_SELECTIVE, only entities + specified as cacheable will be cached. When set to + DISABLE_SELECTIVE, entities specified as not cacheable + will not be cached. When not specified or when set to + UNSPECIFIED, provider defaults may apply. + + + + + + + + + + + + The validation mode to be used for the persistence unit. + + + + + + + + + + + + + A list of standard and vendor-specific properties + and hints. + + + + + + + + + A name-value pair. + + + + + + + + + + + + + + + + + + + + Name used in code to reference this persistence unit. + + + + + + + + + + + + Type of transactions used by EntityManagers from this + persistence unit. + + + + + + + + + + + + + + + + + + + public enum PersistenceUnitTransactionType {JTA, RESOURCE_LOCAL}; + + + + + + + + + + + + + + + + public enum SharedCacheMode { ALL, NONE, ENABLE_SELECTIVE, DISABLE_SELECTIVE, UNSPECIFIED}; + + + + + + + + + + + + + + + + + + + public enum ValidationMode { AUTO, CALLBACK, NONE}; + + + + + + + + + + + Index: 3rdParty_sources/persistence-api/javax/persistence/spi/ClassTransformer.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/spi/ClassTransformer.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/spi/ClassTransformer.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,61 @@ +/******************************************************************************* + * 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.spi; + +import java.security.ProtectionDomain; +import java.lang.instrument.IllegalClassFormatException; + +/** + * A persistence provider supplies an instance of this + * interface to the {@link PersistenceUnitInfo#addTransformer + * PersistenceUnitInfo.addTransformer} + * method. The supplied transformer instance will get + * called to transform entity class files when they are + * loaded or redefined. The transformation occurs before + * the class is defined by the JVM. + * + * @since Java Persistence 1.0 + */ +public interface ClassTransformer { + + /** + * Invoked when a class is being loaded or redefined. + * The implementation of this method may transform the + * supplied class file and return a new replacement class + * file. + * + * @param loader the defining loader of the class to be + * transformed, may be null if the bootstrap loader + * @param className the name of the class in the internal form + * of fully qualified class and interface names + * @param classBeingRedefined if this is a redefine, the + * class being redefined, otherwise null + * @param protectionDomain the protection domain of the + * class being defined or redefined + * @param classfileBuffer the input byte buffer in class + * file format - must not be modified + * @return a well-formed class file buffer (the result of + * the transform), or null if no transform is performed + * @throws IllegalClassFormatException if the input does + * not represent a well-formed class file + */ + byte[] transform(ClassLoader loader, + String className, + Class classBeingRedefined, + ProtectionDomain protectionDomain, + byte[] classfileBuffer) + throws IllegalClassFormatException; +} Index: 3rdParty_sources/persistence-api/javax/persistence/spi/LoadState.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/spi/LoadState.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/spi/LoadState.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,30 @@ +/******************************************************************************* + * 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.spi; + +/** + * Load states returned by the {@link ProviderUtil} SPI methods. + * @since Java Persistence 2.0 + * + */ +public enum LoadState { + /** The state of the element is known to have been loaded. */ + LOADED, + /** The state of the element is known not to have been loaded. */ + NOT_LOADED, + /** The load state of the element cannot be determined. */ + UNKNOWN +} Index: 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceProvider.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceProvider.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceProvider.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2014 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.spi; + +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceException; +import java.util.Map; + +/** + * Interface implemented by the persistence provider. + * + *

It is invoked by the container in Java EE environments and + * by the {@link javax.persistence.Persistence} class in Java SE environments to + * create an {@link javax.persistence.EntityManagerFactory} and/or to cause + * schema generation to occur. + * + * @since Java Persistence 1.0 + */ +public interface PersistenceProvider { + + /** + * Called by Persistence class when an + * EntityManagerFactory is to be created. + * + * @param emName the name of the persistence unit + * @param map a Map of properties for use by the + * persistence provider. These properties may be used to + * override the values of the corresponding elements in + * the persistence.xml file or specify values for + * properties not specified in the persistence.xml + * (and may be null if no properties are specified). + * @return EntityManagerFactory for the persistence unit, + * or null if the provider is not the right provider + */ + public EntityManagerFactory createEntityManagerFactory(String emName, Map map); + + /** + * Called by the container when an EntityManagerFactory + * is to be created. + * + * @param info metadata for use by the persistence provider + * @param map a Map of integration-level properties for use + * by the persistence provider (may be null if no properties + * are specified). These properties may include properties to + * control schema generation. + * If a Bean Validation provider is present in the classpath, + * the container must pass the ValidatorFactory instance in + * the map with the key "javax.persistence.validation.factory". + * If the containing archive is a bean archive, the container + * must pass the BeanManager instance in the map with the key + * "javax.persistence.bean.manager". + * @return EntityManagerFactory for the persistence unit + * specified by the metadata + */ + public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map); + + + /** + * Create database schemas and/or tables and/or create DDL + * scripts as determined by the supplied properties. + *

+ * Called by the container when schema generation is to + * occur as a separate phase from creation of the entity + * manager factory. + *

+ * @param info metadata for use by the persistence provider + * @param map properties for schema generation; these may + * also include provider-specific properties + * @throws PersistenceException if insufficient or inconsistent + * configuration information is provided of if schema + * generation otherwise fails + * + * @since Java Persistence 2.1 + */ + public void generateSchema(PersistenceUnitInfo info, Map map); + + /** + * Create database schemas and/or tables and/or create DDL + * scripts as determined by the supplied properties. + *

+ * Called by the Persistence class when schema generation is to + * occur as a separate phase from creation of the entity + * manager factory. + *

+ * @param persistenceUnitName the name of the persistence unit + * @param map properties for schema generation; these may + * also contain provider-specific properties. The + * value of these properties override any values that + * may have been configured elsewhere. + * @return true if schema was generated, otherwise false + * @throws PersistenceException if insufficient or inconsistent + * configuration information is provided or if schema + * generation otherwise fails + * + * @since Java Persistence 2.1 + */ + public boolean generateSchema(String persistenceUnitName, Map map); + + /** + * Return the utility interface implemented by the persistence + * provider. + * @return ProviderUtil interface + * + * @since Java Persistence 2.0 + */ + public ProviderUtil getProviderUtil(); +} + Index: 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceProviderResolver.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceProviderResolver.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceProviderResolver.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,49 @@ +/******************************************************************************* + * 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.spi; + +import java.util.List; + +/** + * Determine the list of persistence providers available in the + * runtime environment. + * + *

Implementations must be thread-safe. + * + *

Note that the getPersistenceProviders method can potentially + * be called many times: it is recommended that the implementation + * of this method make use of caching. + * + * @see PersistenceProvider + * @since Java Persistence 2.0 + */ +public interface PersistenceProviderResolver { + + /** + * Returns a list of the PersistenceProvider implementations + * available in the runtime environment. + * + * @return list of the persistence providers available + * in the environment + */ + List getPersistenceProviders(); + + /** + * Clear cache of providers. + * + */ + void clearCachedProviders(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceProviderResolverHolder.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceProviderResolverHolder.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceProviderResolverHolder.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,309 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2017 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: + * Lukas Jungmann - Java Persistence 2.2 + * Linda DeMichiel - Java Persistence 2.1 + * Linda DeMichiel - Java Persistence 2.0 + * + ******************************************************************************/ +package javax.persistence.spi; + +import java.lang.ref.ReferenceQueue; +import java.lang.ref.SoftReference; +import java.lang.ref.WeakReference; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.List; +import java.util.HashMap; +import java.util.Iterator; +import java.util.ServiceConfigurationError; +import java.util.ServiceLoader; +import java.util.logging.Level; +import java.util.logging.Logger; + + +/** + * Holds the global {@link javax.persistence.spi.PersistenceProviderResolver} + * instance. If no PersistenceProviderResolver is set by the + * environment, the default PersistenceProviderResolver is used. + * + * Implementations must be thread-safe. + * + * @since Java Persistence 2.0 + */ +public class PersistenceProviderResolverHolder { + + private static PersistenceProviderResolver singleton = new DefaultPersistenceProviderResolver(); + + /** + * Returns the current persistence provider resolver. + * + * @return the current persistence provider resolver + */ + public static PersistenceProviderResolver getPersistenceProviderResolver() { + return singleton; + } + + /** + * Defines the persistence provider resolver used. + * + * @param resolver persistence provider resolver to be used. + */ + public static void setPersistenceProviderResolver(PersistenceProviderResolver resolver) { + if (resolver == null) { + singleton = new DefaultPersistenceProviderResolver(); + } else { + singleton = resolver; + } + } + + /** + * Default provider resolver class to use when none is explicitly set. + * + * Uses service loading mechanism as described in the Java Persistence + * specification. A ServiceLoader.load() call is made with the current context + * classloader to find the service provider files on the classpath. + */ + private static class DefaultPersistenceProviderResolver implements PersistenceProviderResolver { + + /** + * Cached list of available providers cached by CacheKey to ensure + * there is not potential for provider visibility issues. + */ + private volatile HashMap providers = new HashMap(); + + /** + * Queue for reference objects referring to class loaders or persistence providers. + */ + private static final ReferenceQueue referenceQueue = new ReferenceQueue(); + + public List getPersistenceProviders() { + // Before we do the real loading work, see whether we need to + // do some cleanup: If references to class loaders or + // persistence providers have been nulled out, remove all related + // information from the cache. + processQueue(); + + ClassLoader loader = getContextClassLoader(); + CacheKey cacheKey = new CacheKey(loader); + PersistenceProviderReference providersReferent = this.providers.get(cacheKey); + List loadedProviders = null; + + if (providersReferent != null) { + loadedProviders = providersReferent.get(); + } + + if (loadedProviders == null) { + loadedProviders = new ArrayList<>(); + Iterator ipp = ServiceLoader.load(PersistenceProvider.class, loader).iterator(); + try { + while (ipp.hasNext()) { + try { + PersistenceProvider pp = ipp.next(); + loadedProviders.add(pp); + } catch (ServiceConfigurationError sce) { + log(Level.FINEST, sce.toString()); + } + } + } catch (ServiceConfigurationError sce) { + log(Level.FINEST, sce.toString()); + } + + // If none are found we'll log the provider names for diagnostic + // purposes. + if (loadedProviders.isEmpty()) { + log(Level.WARNING, "No valid providers found."); + } + + providersReferent = new PersistenceProviderReference(loadedProviders, referenceQueue, cacheKey); + + this.providers.put(cacheKey, providersReferent); + } + + return loadedProviders; + } + + /** + * Remove garbage collected cache keys & providers. + */ + private void processQueue() { + CacheKeyReference ref; + while ((ref = (CacheKeyReference) referenceQueue.poll()) != null) { + providers.remove(ref.getCacheKey()); + } + } + + /** + * Wraps Thread.currentThread().getContextClassLoader() into a doPrivileged block if security manager is present + */ + private static ClassLoader getContextClassLoader() { + if (System.getSecurityManager() == null) { + return Thread.currentThread().getContextClassLoader(); + } else { + return AccessController.doPrivileged(new PrivilegedAction() { + public ClassLoader run() { + return Thread.currentThread().getContextClassLoader(); + } + }); + } + } + + + private static final String LOGGER_SUBSYSTEM = "javax.persistence.spi"; + + private Logger logger; + + private void log(Level level, String message) { + if (this.logger == null) { + this.logger = Logger.getLogger(LOGGER_SUBSYSTEM); + } + this.logger.log(level, LOGGER_SUBSYSTEM + "::" + message); + } + + /** + * Clear all cached providers + */ + public void clearCachedProviders() { + this.providers.clear(); + } + + + /** + * The common interface to get a CacheKey implemented by + * LoaderReference and PersistenceProviderReference. + */ + private interface CacheKeyReference { + public CacheKey getCacheKey(); + } + + /** + * Key used for cached persistence providers. The key checks + * the class loader to determine if the persistence providers + * is a match to the requested one. The loader may be null. + */ + private class CacheKey implements Cloneable { + + /* Weak Reference to ClassLoader */ + private LoaderReference loaderRef; + + /* Cached Hashcode */ + private int hashCodeCache; + + CacheKey(ClassLoader loader) { + if (loader == null) { + this.loaderRef = null; + } else { + loaderRef = new LoaderReference(loader, referenceQueue, this); + } + calculateHashCode(); + } + + ClassLoader getLoader() { + return (loaderRef != null) ? loaderRef.get() : null; + } + + public boolean equals(Object other) { + if (this == other) { + return true; + } + try { + final CacheKey otherEntry = (CacheKey) other; + // quick check to see if they are not equal + if (hashCodeCache != otherEntry.hashCodeCache) { + return false; + } + // are refs (both non-null) or (both null)? + if (loaderRef == null) { + return otherEntry.loaderRef == null; + } + ClassLoader loader = loaderRef.get(); + return (otherEntry.loaderRef != null) + // with a null reference we can no longer find + // out which class loader was referenced; so + // treat it as unequal + && (loader != null) && (loader == otherEntry.loaderRef.get()); + } catch (NullPointerException e) { + } catch (ClassCastException e) { + } + + return false; + } + + public int hashCode() { + return hashCodeCache; + } + + private void calculateHashCode() { + ClassLoader loader = getLoader(); + if (loader != null) { + hashCodeCache = loader.hashCode(); + } + } + + public Object clone() { + try { + CacheKey clone = (CacheKey) super.clone(); + if (loaderRef != null) { + clone.loaderRef = new LoaderReference(loaderRef.get(), referenceQueue, clone); + } + return clone; + } catch (CloneNotSupportedException e) { + // this should never happen + throw new InternalError(); + } + } + + public String toString() { + return "CacheKey[" + getLoader() + ")]"; + } + } + + /** + * References to class loaders are weak references, so that they can be + * garbage collected when nobody else is using them. The DefaultPersistenceProviderResolver + * class has no reason to keep class loaders alive. + */ + private class LoaderReference extends WeakReference + implements CacheKeyReference { + private CacheKey cacheKey; + + @SuppressWarnings("unchecked") + LoaderReference(ClassLoader referent, ReferenceQueue q, CacheKey key) { + super(referent, q); + cacheKey = key; + } + + public CacheKey getCacheKey() { + return cacheKey; + } + } + + /** + * References to persistence provider are soft references so that they can be garbage + * collected when they have no hard references. + */ + private class PersistenceProviderReference extends SoftReference> + implements CacheKeyReference { + private CacheKey cacheKey; + + @SuppressWarnings("unchecked") + PersistenceProviderReference(List referent, ReferenceQueue q, CacheKey key) { + super(referent, q); + cacheKey = key; + } + + public CacheKey getCacheKey() { + return cacheKey; + } + } + } +} Index: 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceUnitInfo.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceUnitInfo.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceUnitInfo.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,220 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2014 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.spi; + +import javax.sql.DataSource; +import java.util.List; +import java.util.Properties; +import java.net.URL; +import javax.persistence.SharedCacheMode; +import javax.persistence.ValidationMode; + +/** + * Interface implemented by the container and used by the + * persistence provider when creating an {@link javax.persistence.EntityManagerFactory}. + * + * @since Java Persistence 1.0 + */ +public interface PersistenceUnitInfo { + + /** + * Returns the name of the persistence unit. Corresponds to the + * name attribute in the persistence.xml file. + * @return the name of the persistence unit + */ + public String getPersistenceUnitName(); + + /** + * Returns the fully qualified name of the persistence provider + * implementation class. Corresponds to the provider element in + * the persistence.xml file. + * @return the fully qualified name of the persistence provider + * implementation class + */ + public String getPersistenceProviderClassName(); + + /** + * Returns the transaction type of the entity managers created by + * the EntityManagerFactory. The transaction type corresponds to + * the transaction-type attribute in the persistence.xml file. + * @return transaction type of the entity managers created + * by the EntityManagerFactory + */ + public PersistenceUnitTransactionType getTransactionType(); + + /** + * Returns the JTA-enabled data source to be used by the + * persistence provider. The data source corresponds to the + * jta-data-source element in the persistence.xml file or is + * provided at deployment or by the container. + * @return the JTA-enabled data source to be used by the + * persistence provider + */ + public DataSource getJtaDataSource(); + + /** + * Returns the non-JTA-enabled data source to be used by the + * persistence provider for accessing data outside a JTA + * transaction. The data source corresponds to the named + * non-jta-data-source element in the persistence.xml file or + * provided at deployment or by the container. + * @return the non-JTA-enabled data source to be used by the + * persistence provider for accessing data outside a JTA + * transaction + */ + public DataSource getNonJtaDataSource(); + + /** + * Returns the list of the names of the mapping files that the + * persistence provider must load to determine the mappings for + * the entity classes. The mapping files must be in the standard + * XML mapping format, be uniquely named and be resource-loadable + * from the application classpath. Each mapping file name + * corresponds to a mapping-file element in the + * persistence.xml file. + * @return the list of mapping file names that the persistence + * provider must load to determine the mappings for the entity + * classes + */ + public List getMappingFileNames(); + + /** + * Returns a list of URLs for the jar files or exploded jar + * file directories that the persistence provider must examine + * for managed classes of the persistence unit. Each URL + * corresponds to a jar-file element in the + * persistence.xml file. A URL will either be a + * file: URL referring to a jar file or referring to a directory + * that contains an exploded jar file, or some other URL from + * which an InputStream in jar format can be obtained. + * @return a list of URL objects referring to jar files or + * directories + */ + public List getJarFileUrls(); + + /** + * Returns the URL for the jar file or directory that is the + * root of the persistence unit. (If the persistence unit is + * rooted in the WEB-INF/classes directory, this will be the + * URL of that directory.) + * The URL will either be a file: URL referring to a jar file + * or referring to a directory that contains an exploded jar + * file, or some other URL from which an InputStream in jar + * format can be obtained. + * @return a URL referring to a jar file or directory + */ + public URL getPersistenceUnitRootUrl(); + + /** + * Returns the list of the names of the classes that the + * persistence provider must add to its set of managed + * classes. Each name corresponds to a named class element in the + * persistence.xml file. + * @return the list of the names of the classes that the + * persistence provider must add to its set of managed + * classes + */ + public List getManagedClassNames(); + + /** + * Returns whether classes in the root of the persistence unit + * that have not been explicitly listed are to be included in the + * set of managed classes. This value corresponds to the + * exclude-unlisted-classes element in the persistence.xml file. + * @return whether classes in the root of the persistence + * unit that have not been explicitly listed are to be + * included in the set of managed classes + */ + public boolean excludeUnlistedClasses(); + + /** + * Returns the specification of how the provider must use + * a second-level cache for the persistence unit. + * The result of this method corresponds to the shared-cache-mode + * element in the persistence.xml file. + * @return the second-level cache mode that must be used by the + * provider for the persistence unit + * + * @since Java Persistence 2.0 + */ + public SharedCacheMode getSharedCacheMode(); + + /** + * Returns the validation mode to be used by the persistence + * provider for the persistence unit. The validation mode + * corresponds to the validation-mode element in the + * persistence.xml file. + * @return the validation mode to be used by the + * persistence provider for the persistence unit + * + * @since Java Persistence 2.0 + */ + public ValidationMode getValidationMode(); + + /** + * Returns a properties object. Each property corresponds to a + * property element in the persistence.xml file + * or to a property set by the container. + * @return Properties object + */ + public Properties getProperties(); + + /** + * Returns the schema version of the persistence.xml file. + * @return persistence.xml schema version + * + * @since Java Persistence 2.0 + */ + public String getPersistenceXMLSchemaVersion(); + + /** + * Returns ClassLoader that the provider may use to load any + * classes, resources, or open URLs. + * @return ClassLoader that the provider may use to load any + * classes, resources, or open URLs + */ + public ClassLoader getClassLoader(); + + /** + * Add a transformer supplied by the provider that will be + * called for every new class definition or class redefinition + * that gets loaded by the loader returned by the + * {@link PersistenceUnitInfo#getClassLoader} method. The transformer + * has no effect on the result returned by the + * {@link PersistenceUnitInfo#getNewTempClassLoader} method. + * Classes are only transformed once within the same classloading + * scope, regardless of how many persistence units they may be + * a part of. + * @param transformer provider-supplied transformer that the + * container invokes at class-(re)definition time + */ + public void addTransformer(ClassTransformer transformer); + + /** + * Return a new instance of a ClassLoader that the provider may + * use to temporarily load any classes, resources, or open + * URLs. The scope and classpath of this loader is exactly the + * same as that of the loader returned by {@link + * PersistenceUnitInfo#getClassLoader}. None of the classes loaded + * by this class loader will be visible to application + * components. The provider may only use this ClassLoader within + * the scope of the {@link + * PersistenceProvider#createContainerEntityManagerFactory} call. + * @return temporary ClassLoader with same visibility as current + * loader + */ + public ClassLoader getNewTempClassLoader(); +} Index: 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceUnitTransactionType.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceUnitTransactionType.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/spi/PersistenceUnitTransactionType.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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.spi; + +/** + * Specifies whether entity managers created by the {@link + * javax.persistence.EntityManagerFactory} will be JTA or + * resource-local entity managers. + * + * @since Java Persistence 1.0 + */ +public enum PersistenceUnitTransactionType { + + /** JTA entity managers will be created. */ + JTA, + + /** Resource-local entity managers will be created. */ + RESOURCE_LOCAL +} Index: 3rdParty_sources/persistence-api/javax/persistence/spi/ProviderUtil.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/spi/ProviderUtil.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/spi/ProviderUtil.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,92 @@ +/******************************************************************************* + * 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.spi; + +/** + * Utility interface implemented by the persistence provider. This + * interface is invoked by the {@link + * javax.persistence.PersistenceUtil} implementation to determine + * the load status of an entity or entity attribute. + * + * @since Java Persistence 2.0 + */ +public interface ProviderUtil { + + /** + * If the provider determines that the entity has been provided + * by itself and that the state of the specified attribute has + * been loaded, this method returns LoadState.LOADED. + *

If the provider determines that the entity has been provided + * by itself and that either entity attributes with FetchType.EAGER + * have not been loaded or that the state of the specified + * attribute has not been loaded, this methods returns + * LoadState.NOT_LOADED. + *

If a provider cannot determine the load state, this method + * returns LoadState.UNKNOWN. + *

The provider's implementation of this method must not obtain + * a reference to an attribute value, as this could trigger the + * loading of entity state if the entity has been provided by a + * different provider. + * @param entity entity instance + * @param attributeName name of attribute whose load status is + * to be determined + * @return load status of the attribute + */ + public LoadState isLoadedWithoutReference(Object entity, String attributeName); + + /** + * If the provider determines that the entity has been provided + * by itself and that the state of the specified attribute has + * been loaded, this method returns LoadState.LOADED. + *

If a provider determines that the entity has been provided + * by itself and that either the entity attributes with FetchType.EAGER + * have not been loaded or that the state of the specified + * attribute has not been loaded, this method returns + * return LoadState.NOT_LOADED. + *

If the provider cannot determine the load state, this method + * returns LoadState.UNKNOWN. + *

The provider's implementation of this method is permitted to + * obtain a reference to the attribute value. (This access is + * safe because providers which might trigger the loading of the + * attribute state will have already been determined by + * isLoadedWithoutReference. ) + * + * @param entity entity instance + * @param attributeName name of attribute whose load status is + * to be determined + * @return load status of the attribute + */ + public LoadState isLoadedWithReference(Object entity, String attributeName); + + /** + * If the provider determines that the entity has been provided + * by itself and that the state of all attributes for which + * FetchType.EAGER has been specified have been loaded, this + * method returns LoadState.LOADED. + *

If the provider determines that the entity has been provided + * by itself and that not all attributes with FetchType.EAGER + * have been loaded, this method returns LoadState.NOT_LOADED. + *

If the provider cannot determine if the entity has been + * provided by itself, this method returns LoadState.UNKNOWN. + *

The provider's implementation of this method must not obtain + * a reference to any attribute value, as this could trigger the + * loading of entity state if the entity has been provided by a + * different provider. + * @param entity whose loaded status is to be determined + * @return load status of the entity + */ + public LoadState isLoaded(Object entity); +} Index: 3rdParty_sources/persistence-api/javax/persistence/spi/package-info.java =================================================================== diff -u --- 3rdParty_sources/persistence-api/javax/persistence/spi/package-info.java (revision 0) +++ 3rdParty_sources/persistence-api/javax/persistence/spi/package-info.java (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -0,0 +1,20 @@ +/******************************************************************************* + * 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 + * + ******************************************************************************/ + +/** + * SPI for Java Persistence providers + */ +package javax.persistence.spi; Index: 3rdParty_sources/versions.txt =================================================================== diff -u -r188531e2b734df509672788d897e1030e4b1a24a -rcacda0ef9b2c02f124e1f050882017fbe1be6c7b --- 3rdParty_sources/versions.txt (.../versions.txt) (revision 188531e2b734df509672788d897e1030e4b1a24a) +++ 3rdParty_sources/versions.txt (.../versions.txt) (revision cacda0ef9b2c02f124e1f050882017fbe1be6c7b) @@ -31,6 +31,8 @@ Jackson 2.9.5 +javax.persistence API 2.2 + jLaTexMath 1.0.6 jsonwebtoken 0.9.0