├── .gitignore ├── CONTRIBUTING.md ├── README.md ├── javax.persistence-api ├── pom.xml └── src │ └── main │ ├── java │ └── javax │ │ └── persistence │ │ ├── Access.java │ │ ├── AccessType.java │ │ ├── AssociationOverride.java │ │ ├── AssociationOverrides.java │ │ ├── AttributeConverter.java │ │ ├── AttributeNode.java │ │ ├── AttributeOverride.java │ │ ├── AttributeOverrides.java │ │ ├── Basic.java │ │ ├── Cache.java │ │ ├── CacheRetrieveMode.java │ │ ├── CacheStoreMode.java │ │ ├── Cacheable.java │ │ ├── CascadeType.java │ │ ├── CollectionTable.java │ │ ├── Column.java │ │ ├── ColumnResult.java │ │ ├── ConstraintMode.java │ │ ├── ConstructorResult.java │ │ ├── Convert.java │ │ ├── Converter.java │ │ ├── Converts.java │ │ ├── DiscriminatorColumn.java │ │ ├── DiscriminatorType.java │ │ ├── DiscriminatorValue.java │ │ ├── ElementCollection.java │ │ ├── Embeddable.java │ │ ├── Embedded.java │ │ ├── EmbeddedId.java │ │ ├── Entity.java │ │ ├── EntityExistsException.java │ │ ├── EntityGraph.java │ │ ├── EntityListeners.java │ │ ├── EntityManager.java │ │ ├── EntityManagerFactory.java │ │ ├── EntityNotFoundException.java │ │ ├── EntityResult.java │ │ ├── EntityTransaction.java │ │ ├── EnumType.java │ │ ├── Enumerated.java │ │ ├── ExcludeDefaultListeners.java │ │ ├── ExcludeSuperclassListeners.java │ │ ├── FetchType.java │ │ ├── FieldResult.java │ │ ├── FlushModeType.java │ │ ├── ForeignKey.java │ │ ├── GeneratedValue.java │ │ ├── GenerationType.java │ │ ├── Id.java │ │ ├── IdClass.java │ │ ├── Index.java │ │ ├── Inheritance.java │ │ ├── InheritanceType.java │ │ ├── JoinColumn.java │ │ ├── JoinColumns.java │ │ ├── JoinTable.java │ │ ├── Lob.java │ │ ├── LockModeType.java │ │ ├── LockTimeoutException.java │ │ ├── ManyToMany.java │ │ ├── ManyToOne.java │ │ ├── MapKey.java │ │ ├── MapKeyClass.java │ │ ├── MapKeyColumn.java │ │ ├── MapKeyEnumerated.java │ │ ├── MapKeyJoinColumn.java │ │ ├── MapKeyJoinColumns.java │ │ ├── MapKeyTemporal.java │ │ ├── MappedSuperclass.java │ │ ├── MapsId.java │ │ ├── NamedAttributeNode.java │ │ ├── NamedEntityGraph.java │ │ ├── NamedEntityGraphs.java │ │ ├── NamedNativeQueries.java │ │ ├── NamedNativeQuery.java │ │ ├── NamedQueries.java │ │ ├── NamedQuery.java │ │ ├── NamedStoredProcedureQueries.java │ │ ├── NamedStoredProcedureQuery.java │ │ ├── NamedSubgraph.java │ │ ├── NoResultException.java │ │ ├── NonUniqueResultException.java │ │ ├── OneToMany.java │ │ ├── OneToOne.java │ │ ├── OptimisticLockException.java │ │ ├── OrderBy.java │ │ ├── OrderColumn.java │ │ ├── Parameter.java │ │ ├── ParameterMode.java │ │ ├── Persistence.java │ │ ├── PersistenceContext.java │ │ ├── PersistenceContextType.java │ │ ├── PersistenceContexts.java │ │ ├── PersistenceException.java │ │ ├── PersistenceProperty.java │ │ ├── PersistenceUnit.java │ │ ├── PersistenceUnitUtil.java │ │ ├── PersistenceUnits.java │ │ ├── PersistenceUtil.java │ │ ├── PessimisticLockException.java │ │ ├── PessimisticLockScope.java │ │ ├── PostLoad.java │ │ ├── PostPersist.java │ │ ├── PostRemove.java │ │ ├── PostUpdate.java │ │ ├── PrePersist.java │ │ ├── PreRemove.java │ │ ├── PreUpdate.java │ │ ├── PrimaryKeyJoinColumn.java │ │ ├── PrimaryKeyJoinColumns.java │ │ ├── Query.java │ │ ├── QueryHint.java │ │ ├── QueryTimeoutException.java │ │ ├── RollbackException.java │ │ ├── SecondaryTable.java │ │ ├── SecondaryTables.java │ │ ├── SequenceGenerator.java │ │ ├── SequenceGenerators.java │ │ ├── SharedCacheMode.java │ │ ├── SqlResultSetMapping.java │ │ ├── SqlResultSetMappings.java │ │ ├── StoredProcedureParameter.java │ │ ├── StoredProcedureQuery.java │ │ ├── Subgraph.java │ │ ├── SynchronizationType.java │ │ ├── Table.java │ │ ├── TableGenerator.java │ │ ├── TableGenerators.java │ │ ├── Temporal.java │ │ ├── TemporalType.java │ │ ├── TransactionRequiredException.java │ │ ├── Transient.java │ │ ├── Tuple.java │ │ ├── TupleElement.java │ │ ├── TypedQuery.java │ │ ├── UniqueConstraint.java │ │ ├── ValidationMode.java │ │ ├── Version.java │ │ ├── criteria │ │ ├── AbstractQuery.java │ │ ├── CollectionJoin.java │ │ ├── CommonAbstractCriteria.java │ │ ├── CompoundSelection.java │ │ ├── CriteriaBuilder.java │ │ ├── CriteriaDelete.java │ │ ├── CriteriaQuery.java │ │ ├── CriteriaUpdate.java │ │ ├── Expression.java │ │ ├── Fetch.java │ │ ├── FetchParent.java │ │ ├── From.java │ │ ├── Join.java │ │ ├── JoinType.java │ │ ├── ListJoin.java │ │ ├── MapJoin.java │ │ ├── Order.java │ │ ├── ParameterExpression.java │ │ ├── Path.java │ │ ├── PluralJoin.java │ │ ├── Predicate.java │ │ ├── Root.java │ │ ├── Selection.java │ │ ├── SetJoin.java │ │ ├── Subquery.java │ │ └── package-info.java │ │ ├── metamodel │ │ ├── Attribute.java │ │ ├── BasicType.java │ │ ├── Bindable.java │ │ ├── CollectionAttribute.java │ │ ├── EmbeddableType.java │ │ ├── EntityType.java │ │ ├── IdentifiableType.java │ │ ├── ListAttribute.java │ │ ├── ManagedType.java │ │ ├── MapAttribute.java │ │ ├── MappedSuperclassType.java │ │ ├── Metamodel.java │ │ ├── PluralAttribute.java │ │ ├── SetAttribute.java │ │ ├── SingularAttribute.java │ │ ├── StaticMetamodel.java │ │ ├── Type.java │ │ └── package-info.java │ │ ├── package-info.java │ │ └── spi │ │ ├── ClassTransformer.java │ │ ├── LoadState.java │ │ ├── PersistenceProvider.java │ │ ├── PersistenceProviderResolver.java │ │ ├── PersistenceProviderResolverHolder.java │ │ ├── PersistenceUnitInfo.java │ │ ├── PersistenceUnitTransactionType.java │ │ ├── ProviderUtil.java │ │ └── package-info.java │ └── resources │ └── javax │ └── persistence │ ├── orm_1_0.xsd │ ├── orm_2_0.xsd │ ├── orm_2_1.xsd │ ├── orm_2_2.xsd │ ├── persistence_1_0.xsd │ ├── persistence_2_0.xsd │ ├── persistence_2_1.xsd │ └── persistence_2_2.xsd └── jsr338-MR ├── ChangeLog-JPA-2.2-MR.txt ├── JavaPersistence.pdf └── persistence_2_2.xsd /.gitignore: -------------------------------------------------------------------------------- 1 | /javax.persistence-api/target/ -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | --- 4 | 5 | # Source Code Submissions 6 | We welcome your contributions and look forward to collaborating with you. We can only accept source code repository 7 | submissions from users who have signed and returned the Oracle 8 | Contributor Agreement. You will find details and the agreement to sign at this OTN web page: 9 | [Oracle Contributor Agreement](http://www.oracle.com/technetwork/community/oca-486395.html). 10 | 11 | # Other Contributions 12 | For all project Submissions other than source code repository contributions, the following also applies: Oracle does 13 | not claim ownership of Your Submissions. However, in order to fulfill 14 | the purposes of this project, You must give Oracle and all Users 15 | the right to post, access, discuss, use, publish, disseminate, and refine 16 | Your Submissions. 17 | 18 | In legalese: *You hereby grant to Oracle and all 19 | Users a royalty-free, perpetual, irrevocable, worldwide, non-exclusive, 20 | and fully sub-licensable right and license, under Your intellectual 21 | property rights, to reproduce, modify, adapt, publish, translate, create 22 | derivative works from, distribute, perform, display, and use Your 23 | Submissions (in whole or part) and to incorporate or implement them in 24 | other works in any form, media, or technology now known or later 25 | developed, all subject to the obligation to retain any copyright notices 26 | included in Your Submissions. All Users, Oracle, and their 27 | sublicensees are responsible for any modifications they make to the 28 | Submissions of others.* 29 | 30 | Copyright © 2017 Oracle and/or its affiliates. All rights reserved. 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### :warning:This project is now part of the EE4J initiative. This repository has been archived as all activities are now happening in the [corresponding Eclipse repository](https://github.com/eclipse-ee4j/jpa-api). See [here](https://www.eclipse.org/ee4j/status.php) for the overall EE4J transition status. 2 | 3 | --- 4 | # Java Persistence API specification 5 | 6 | This is collaboration repository for JSR 338: Java Persistence 2.1: https://www.jcp.org/en/jsr/detail?id=338 7 | 8 | For specification related discussions join https://javaee.groups.io/g/jpa-spec 9 | 10 | Latest version of the specification: [JavaPersistence.pdf](jsr338-MR/JavaPersistence.pdf) 11 | 12 | Latest version of the XML schema for persitence.xml: [persistence_2_2.xsd](jsr338-MR/persistence_2_2.xsd) 13 | 14 | Reference of the API defined by the specification and full reference implementation of the specification are available 15 | through the [EclipseLink project](eclipselink.org) with sources of the API available at: https://github.com/eclipse/javax.persistence 16 | and of the RI at: https://github.com/eclipse/eclipselink.runtime 17 | 18 | Latest version of the javadoc: https://javadoc.io/doc/org.eclipse.persistence/javax.persistence/2.2.0 19 | 20 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/Access.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import static java.lang.annotation.ElementType.FIELD; 19 | import static java.lang.annotation.ElementType.METHOD; 20 | import static java.lang.annotation.ElementType.TYPE; 21 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 | 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * Used to specify an access type to be applied to an entity class, 28 | * mapped superclass, or embeddable class, or to a specific attribute 29 | * of such a class. 30 | * 31 | * @since Java Persistence 2.0 32 | */ 33 | @Target( { TYPE, METHOD, FIELD }) 34 | @Retention(RUNTIME) 35 | public @interface Access { 36 | 37 | /** 38 | * (Required) Specification of field- or property-based access. 39 | */ 40 | AccessType value(); 41 | } 42 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/AccessType.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | /** 19 | * Used with the {@link Access} annotation to specify an access 20 | * type to be applied to an entity class, mapped superclass, or 21 | * embeddable class, or to a specific attribute of such a class. 22 | * 23 | * @see Access 24 | * 25 | * @since Java Persistence 2.0 26 | */ 27 | public enum AccessType { 28 | 29 | /** Field-based access is used. */ 30 | FIELD, 31 | 32 | /** Property-based access is used. */ 33 | PROPERTY 34 | } 35 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/AssociationOverrides.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.TYPE; 21 | import static java.lang.annotation.ElementType.METHOD; 22 | import static java.lang.annotation.ElementType.FIELD; 23 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 24 | 25 | /** 26 | * Used to override mappings of multiple relationship properties or fields. 27 | * 28 | *
29 | * 30 | * Example: 31 | * 32 | * @MappedSuperclass 33 | * public class Employee { 34 | * 35 | * @Id protected Integer id; 36 | * @Version protected Integer version; 37 | * @ManyToOne protected Address address; 38 | * @OneToOne protected Locker locker; 39 | * 40 | * public Integer getId() { ... } 41 | * public void setId(Integer id) { ... } 42 | * public Address getAddress() { ... } 43 | * public void setAddress(Address address) { ... } 44 | * public Locker getLocker() { ... } 45 | * public void setLocker(Locker locker) { ... } 46 | * ... 47 | * } 48 | * 49 | * @Entity 50 | * @AssociationOverrides({ 51 | * @AssociationOverride( 52 | * name="address", 53 | * joinColumns=@JoinColumn("ADDR_ID")), 54 | * @AttributeOverride( 55 | * name="locker", 56 | * joinColumns=@JoinColumn("LCKR_ID")) 57 | * }) 58 | * public PartTimeEmployee { ... } 59 | *60 | * 61 | *@see AssociationOverride 62 | * 63 | * @since Java Persistence 1.0 64 | */ 65 | @Target({TYPE, METHOD, FIELD}) 66 | @Retention(RUNTIME) 67 | 68 | public @interface AssociationOverrides { 69 | 70 | /** 71 | *(Required) The association override mappings that are to be 72 | * applied to the relationship field or property . 73 | */ 74 | AssociationOverride[] value(); 75 | } 76 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/AttributeConverter.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * 14 | ******************************************************************************/ 15 | package javax.persistence; 16 | 17 | /** 18 | * A class that implements this interface can be used to convert 19 | * entity attribute state into database column representation 20 | * and back again. 21 | * Note that the X and Y types may be the same Java type. 22 | * 23 | * @param
dbData
type for the corresponding
43 | * column for use by the JDBC driver: i.e., persistence providers are
44 | * not expected to do such type conversion.
45 | *
46 | * @param dbData the data from the database column to be
47 | * converted
48 | * @return the converted value to be stored in the entity
49 | * attribute
50 | */
51 | public X convertToEntityAttribute (Y dbData);
52 | }
53 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/AttributeNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | *
14 | ******************************************************************************/
15 |
16 | package javax.persistence;
17 |
18 | import java.util.Map;
19 |
20 | /**
21 | * Represents an attribute node of an entity graph.
22 | *
23 | * @param 29 | * 30 | * Example: 31 | * 32 | * @Embedded 33 | * @AttributeOverrides({ 34 | * @AttributeOverride(name="startDate", 35 | * column=@Column("EMP_START")), 36 | * @AttributeOverride(name="endDate", 37 | * column=@Column("EMP_END")) 38 | * }) 39 | * public EmploymentPeriod getEmploymentPeriod() { ... } 40 | * 41 | *42 | * 43 | * 44 | * @see AttributeOverride 45 | * 46 | * @since Java Persistence 1.0 47 | */ 48 | @Target({TYPE, METHOD, FIELD}) 49 | @Retention(RUNTIME) 50 | 51 | public @interface AttributeOverrides { 52 | 53 | /** (Required) One or more field or property mapping overrides. */ 54 | AttributeOverride[] value(); 55 | } 56 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/Cache.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | /** 19 | * Interface used to interact with the second-level cache. 20 | * If a cache is not in use, the methods of this interface have 21 | * no effect, except for
contains
, which returns false.
22 | *
23 | * @since Java Persistence 2.0
24 | */
25 | public interface Cache {
26 |
27 | /**
28 | * Whether the cache contains data for the given entity.
29 | * @param cls entity class
30 | * @param primaryKey primary key
31 | * @return boolean indicating whether the entity is in the cache
32 | */
33 | public boolean contains(Class cls, Object primaryKey);
34 |
35 | /**
36 | * Remove the data for the given entity from the cache.
37 | * @param cls entity class
38 | * @param primaryKey primary key
39 | */
40 | public void evict(Class cls, Object primaryKey);
41 |
42 | /**
43 | * Remove the data for entities of the specified class (and its
44 | * subclasses) from the cache.
45 | * @param cls entity class
46 | */
47 | public void evict(Class cls);
48 |
49 | /**
50 | * Clear the cache.
51 | */
52 | public void evictAll();
53 |
54 | /**
55 | * Return an object of the specified type to allow access to the
56 | * provider-specific API. If the provider's Cache
57 | * implementation does not support the specified class, the
58 | * PersistenceException is thrown.
59 | * @param cls the class of the object to be returned. This is
60 | * normally either the underlying Cache implementation
61 | * class or an interface that it implements.
62 | * @return an instance of the specified class
63 | * @throws PersistenceException if the provider does not
64 | * support the call
65 | * @since Java Persistence 2.1
66 | */
67 | public javax.persistence.cache.retrieveMode
property to
21 | * specify the behavior when data is retrieved by the
22 | * find
methods and by queries.
23 | *
24 | * @since Java Persistence 2.0
25 | */
26 | public enum CacheRetrieveMode {
27 |
28 | /**
29 | * Read entity data from the cache: this is
30 | * the default behavior.
31 | */
32 | USE,
33 |
34 | /**
35 | * Bypass the cache: get data directly from
36 | * the database.
37 | */
38 | BYPASS
39 | }
40 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/CacheStoreMode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Used as the value of the
20 | * javax.persistence.cache.storeMode
property to specify
21 | * the behavior when data is read from the database and when data is
22 | * committed into the database.
23 | *
24 | * @since Java Persistence 2.0
25 | */
26 | public enum CacheStoreMode {
27 |
28 | /**
29 | * Insert entity data into cache when read from database
30 | * and insert/update entity data when committed into database:
31 | * this is the default behavior. Does not force refresh
32 | * of already cached items when reading from database.
33 | */
34 | USE,
35 |
36 | /**
37 | * Don't insert into cache.
38 | */
39 | BYPASS,
40 |
41 | /**
42 | * Insert/update entity data into cache when read
43 | * from database and when committed into database.
44 | * Forces refresh of cache for items read from database.
45 | */
46 | REFRESH
47 | }
48 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/Cacheable.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import static java.lang.annotation.ElementType.TYPE;
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.Target;
22 |
23 | /**
24 | * Specifies whether an entity should be cached if caching is enabled
25 | * when the value of the persistence.xml
caching element
26 | * is ENABLE_SELECTIVE
or DISABLE_SELECTIVE
.
27 | * The value of the Cacheable
annotation is inherited by
28 | * subclasses; it can be overridden by specifying
29 | * Cacheable
on a subclass.
30 | *
31 | * Cacheable(false)
means that the entity and its state must
32 | * not be cached by the provider.
33 | *
34 | * @since Java Persistence 2.0
35 | */
36 | @Target( { TYPE })
37 | @Retention(RUNTIME)
38 | public @interface Cacheable {
39 |
40 | /**
41 | * (Optional) Whether or not the entity should be cached.
42 | */
43 | boolean value() default true;
44 | }
45 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/CascadeType.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Defines the set of cascadable operations that are propagated
20 | * to the associated entity.
21 | * The value cascade=ALL
is equivalent to
22 | * cascade={PERSIST, MERGE, REMOVE, REFRESH, DETACH}
.
23 | *
24 | * @since Java Persistence 1.0
25 | */
26 | public enum CascadeType {
27 |
28 | /** Cascade all operations */
29 | ALL,
30 |
31 | /** Cascade persist operation */
32 | PERSIST,
33 |
34 | /** Cascade merge operation */
35 | MERGE,
36 |
37 | /** Cascade remove operation */
38 | REMOVE,
39 |
40 | /** Cascade refresh operation */
41 | REFRESH,
42 |
43 | /**
44 | * Cascade detach operation
45 | *
46 | * @since Java Persistence 2.0
47 | *
48 | */
49 | DETACH
50 | }
51 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/ConstraintMode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | *
14 | ******************************************************************************/
15 | package javax.persistence;
16 |
17 | /**
18 | * Used to control the application of a constraint.
19 | *
20 | * @since Java Persistence 2.1
21 | */
22 | public enum ConstraintMode {
23 |
24 | /** Apply the constraint. */
25 | CONSTRAINT,
26 |
27 | /** Do not apply the constraint. */
28 | NO_CONSTRAINT,
29 |
30 | /** Use the provider-defined default behavior. */
31 | PROVIDER_DEFAULT
32 | }
33 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/Converts.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | *
14 | ******************************************************************************/
15 | package javax.persistence;
16 |
17 | import java.lang.annotation.Target;
18 | import java.lang.annotation.Retention;
19 | import static java.lang.annotation.ElementType.TYPE;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.ElementType.FIELD;
22 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
23 |
24 | /**
25 | * Used to group Convert
annotations. Multiple converters
26 | * must not be applied to the same basic attribute.
27 | *
28 | * @see Convert
29 | * @since Java Persistence 2.1
30 | */
31 | @Target({METHOD, FIELD, TYPE})
32 | @Retention(RUNTIME)
33 | public @interface Converts {
34 |
35 | /**
36 | * The Convert
mappings that are to be applied.
37 | *
38 | */
39 | Convert[] value();
40 | }
41 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/DiscriminatorType.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Defines supported types of the discriminator column.
20 | *
21 | * @since Java Persistence 1.0
22 | */
23 | public enum DiscriminatorType {
24 |
25 | /**
26 | * String as the discriminator type.
27 | */
28 | STRING,
29 |
30 | /**
31 | * Single character as the discriminator type.
32 | */
33 | CHAR,
34 |
35 | /**
36 | * Integer as the discriminator type.
37 | */
38 | INTEGER
39 | }
40 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/ElementCollection.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.ElementType.FIELD;
22 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
23 | import static javax.persistence.FetchType.LAZY;
24 |
25 | /**
26 | * Specifies a collection of instances of a basic type or embeddable
27 | * class.
28 | * Must be specified if the collection is to be mapped by
29 | * means of a collection table.
30 | *
31 | *
32 | * Example: 33 | * 34 | * @Entity public class Person { 35 | * @Id protected String ssn; 36 | * protected String name; 37 | * ... 38 | * @ElementCollection 39 | * protected Set<String> nickNames = new HashSet(); 40 | * ... 41 | * } 42 | *43 | * 44 | * @since Java Persistence 2.0 45 | */ 46 | @Target( { METHOD, FIELD }) 47 | @Retention(RUNTIME) 48 | public @interface ElementCollection { 49 | 50 | /** 51 | * (Optional) The basic or embeddable class that is the element 52 | * type of the collection. This element is optional only if the 53 | * collection field or property is defined using Java generics, 54 | * and must be specified otherwise. It defaults to the 55 | * paramterized type of the collection when defined using 56 | * generics. 57 | */ 58 | Class targetClass() default void.class; 59 | 60 | /** 61 | * (Optional) Whether the collection should be lazily loaded or must be 62 | * eagerly fetched. The EAGER strategy is a requirement on 63 | * the persistence provider runtime that the collection elements 64 | * must be eagerly fetched. The LAZY strategy is a hint to the 65 | * persistence provider runtime. 66 | */ 67 | FetchType fetch() default LAZY; 68 | } 69 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/Embeddable.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Documented; 21 | import static java.lang.annotation.ElementType.TYPE; 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 23 | 24 | /** 25 | * Specifies a class whose instances are stored as an intrinsic 26 | * part of an owning entity and share the identity of the entity. 27 | * Each of the persistent properties or fields of the embedded 28 | * object is mapped to the database table for the entity. 29 | * 30 | *
Note that the {@link Transient} annotation may be used to 31 | * designate the non-persistent state of an embeddable class. 32 | * 33 | *
34 | * 35 | * Example 1: 36 | * 37 | * @Embeddable public class EmploymentPeriod { 38 | * @Temporal(DATE) java.util.Date startDate; 39 | * @Temporal(DATE) java.util.Date endDate; 40 | * ... 41 | * } 42 | * 43 | * Example 2: 44 | * 45 | * @Embeddable public class PhoneNumber { 46 | * protected String areaCode; 47 | * protected String localNumber; 48 | * @ManyToOne PhoneServiceProvider provider; 49 | * ... 50 | * } 51 | * 52 | * @Entity public class PhoneServiceProvider { 53 | * @Id protected String name; 54 | * ... 55 | * } 56 | * 57 | * Example 3: 58 | * 59 | * @Embeddable public class Address { 60 | * protected String street; 61 | * protected String city; 62 | * protected String state; 63 | * @Embedded protected Zipcode zipcode; 64 | * } 65 | * 66 | * @Embeddable public class Zipcode { 67 | * protected String zip; 68 | * protected String plusFour; 69 | * } 70 | 71 | 72 | *73 | * 74 | * @since Java Persistence 1.0 75 | */ 76 | @Documented 77 | @Target({TYPE}) 78 | @Retention(RUNTIME) 79 | public @interface Embeddable { 80 | } 81 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/Embedded.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.FIELD; 21 | import static java.lang.annotation.ElementType.METHOD; 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 23 | 24 | /** 25 | * Specifies a persistent field or property of an entity whose 26 | * value is an instance of an embeddable class. The embeddable 27 | * class must be annotated as {@link Embeddable}. 28 | * 29 | *
The AttributeOverride
, AttributeOverrides
,
30 | * AssociationOverride
, and AssociationOverrides
31 | * annotations may be used to override mappings declared or defaulted
32 | * by the embeddable class.
33 | *
34 | *
35 | * Example: 36 | * 37 | * @Embedded 38 | * @AttributeOverrides({ 39 | * @AttributeOverride(name="startDate", column=@Column("EMP_START")), 40 | * @AttributeOverride(name="endDate", column=@Column("EMP_END")) 41 | * }) 42 | * public EmploymentPeriod getEmploymentPeriod() { ... } 43 | *44 | * 45 | * @see Embeddable 46 | * @see AttributeOverride 47 | * @see AttributeOverrides 48 | * @see AssociationOverride 49 | * @see AssociationOverrides 50 | * 51 | * @since Java Persistence 1.0 52 | */ 53 | @Target({METHOD, FIELD}) 54 | @Retention(RUNTIME) 55 | 56 | public @interface Embedded { 57 | } 58 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/Entity.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Documented; 21 | import static java.lang.annotation.ElementType.TYPE; 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 23 | 24 | /** 25 | * Specifies that the class is an entity. This annotation is applied to the 26 | * entity class. 27 | * 28 | * @since Java Persistence 1.0 29 | */ 30 | @Documented 31 | @Target(TYPE) 32 | @Retention(RUNTIME) 33 | public @interface Entity { 34 | 35 | /** 36 | * (Optional) The entity name. Defaults to the unqualified 37 | * name of the entity class. This name is used to refer to the 38 | * entity in queries. The name must not be a reserved literal 39 | * in the Java Persistence query language. 40 | */ 41 | String name() default ""; 42 | } 43 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/EntityListeners.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.TYPE; 21 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 | 23 | /** 24 | * Specifies the callback listener classes to be used for an 25 | * entity or mapped superclass. This annotation may be applied 26 | * to an entity class or mapped superclass. 27 | * 28 | * @since Java Persistence 1.0 29 | */ 30 | @Target({TYPE}) 31 | @Retention(RUNTIME) 32 | public @interface EntityListeners { 33 | 34 | /** The callback listener classes */ 35 | Class[] value(); 36 | } 37 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/EntityNotFoundException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | /** 19 | * Thrown by the persistence provider when an entity reference obtained by 20 | * {@link EntityManager#getReference EntityManager.getReference} 21 | * is accessed but the entity does not exist. Thrown when 22 | * {@link EntityManager#refresh EntityManager.refresh} is called and the 23 | * object no longer exists in the database. 24 | * Thrown when {@link EntityManager#lock EntityManager.lock} is used with 25 | * pessimistic locking is used and the entity no longer exists in the database. 26 | *
The current transaction, if one is active and the persistence context
27 | * has been joined to it, will be marked for rollback.
28 | *
29 | * @see EntityManager#getReference(Class,Object)
30 | * @see EntityManager#refresh(Object)
31 | * @see EntityManager#refresh(Object, LockModeType)
32 | * @see EntityManager#refresh(Object, java.util.Map)
33 | * @see EntityManager#refresh(Object, LockModeType, java.util.Map)
34 | * @see EntityManager#lock(Object, LockModeType)
35 | * @see EntityManager#lock(Object, LockModeType, java.util.Map)
36 | *
37 | * @since Java Persistence 1.0
38 | */
39 | public class EntityNotFoundException extends PersistenceException {
40 |
41 | /**
42 | * Constructs a new EntityNotFoundException
exception with
43 | * null
as its detail message.
44 | */
45 | public EntityNotFoundException() {
46 | super();
47 | }
48 |
49 | /**
50 | * Constructs a new EntityNotFoundException
exception with the
51 | * specified detail message.
52 | *
53 | * @param message
54 | * the detail message.
55 | */
56 | public EntityNotFoundException(String message) {
57 | super(message);
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/EntityResult.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2014 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
21 |
22 | /**
23 | * Used in conjunction with the {@link SqlResultSetMapping} annotation to map the SELECT
24 | * clause of a SQL query to an entity result.
25 | *
26 | *
If this annotation is used, the SQL statement should select 27 | * all of the columns that are mapped to the entity object. 28 | * This should include foreign key columns to related entities. 29 | * The results obtained when insufficient data is available 30 | * are undefined. 31 | * 32 | *
33 | * Example: 34 | * 35 | * Query q = em.createNativeQuery( 36 | * "SELECT o.id, o.quantity, o.item, i.id, i.name, i.description "+ 37 | * "FROM Order o, Item i " + 38 | * "WHERE (o.quantity > 25) AND (o.item = i.id)", 39 | * "OrderItemResults"); 40 | * @SqlResultSetMapping(name="OrderItemResults", 41 | * entities={ 42 | * @EntityResult(entityClass=com.acme.Order.class), 43 | * @EntityResult(entityClass=com.acme.Item.class) 44 | * }) 45 | *46 | * 47 | * @see SqlResultSetMapping 48 | * 49 | * @since Java Persistence 1.0 50 | */ 51 | @Target({}) 52 | @Retention(RUNTIME) 53 | public @interface EntityResult { 54 | 55 | /** The class of the result. */ 56 | Class entityClass(); 57 | 58 | /** 59 | * Maps the columns specified in the SELECT list of the 60 | * query to the properties or fields of the entity class. 61 | */ 62 | FieldResult[] fields() default {}; 63 | 64 | /** 65 | * Specifies the column name (or alias) of the column in 66 | * the SELECT list that is used to determine the type of 67 | * the entity instance. 68 | */ 69 | String discriminatorColumn() default ""; 70 | } 71 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/EnumType.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | /** 19 | * Defines mapping for enumerated types. The constants of this 20 | * enumerated type specify how a persistent property or 21 | * field of an enumerated type should be persisted. 22 | * 23 | * @since Java Persistence 1.0 24 | */ 25 | public enum EnumType { 26 | /** Persist enumerated type property or field as an integer. */ 27 | ORDINAL, 28 | 29 | /** Persist enumerated type property or field as a string. */ 30 | STRING 31 | } 32 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/Enumerated.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2014 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.FIELD; 21 | import static java.lang.annotation.ElementType.METHOD; 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 23 | import static javax.persistence.EnumType.ORDINAL; 24 | 25 | /** 26 | * Specifies that a persistent property or field should be persisted 27 | * as a enumerated type. The
Enumerated
annotation may
28 | * be used in conjunction with the Basic
annotation, or in
29 | * conjunction with the ElementCollection
annotation when the
30 | * element collection value is of basic type. If the enumerated type
31 | * is not specified or the Enumerated
annotation is not
32 | * used, the EnumType
value is assumed to be ORDINAL
.
33 | *
34 | * 35 | * Example: 36 | * 37 | * public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT} 38 | * 39 | * public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE} 40 | * 41 | * @Entity public class Employee { 42 | * public EmployeeStatus getStatus() {...} 43 | * ... 44 | * @Enumerated(STRING) 45 | * public SalaryRate getPayScale() {...} 46 | * ... 47 | * } 48 | *49 | * 50 | * @see Basic 51 | * @see ElementCollection 52 | * 53 | * @since Java Persistence 1.0 54 | */ 55 | @Target({METHOD, FIELD}) 56 | @Retention(RUNTIME) 57 | public @interface Enumerated { 58 | 59 | /** (Optional) The type used in mapping an enum type. */ 60 | EnumType value() default ORDINAL; 61 | } 62 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/ExcludeDefaultListeners.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.TYPE; 21 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 | 23 | /** 24 | * Specifies that the invocation of default listeners is 25 | * to be excluded for the entity class (or mapped superclass) 26 | * and its subclasses. 27 | * 28 | * @since Java Persistence 1.0 29 | */ 30 | @Target({TYPE}) 31 | @Retention(RUNTIME) 32 | public @interface ExcludeDefaultListeners { 33 | } 34 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/ExcludeSuperclassListeners.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.TYPE; 21 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 | 23 | /** 24 | * Specifies that the invocation of superclass listeners is 25 | * to be excluded for the entity class (or mapped superclass) 26 | * and its subclasses. 27 | * 28 | * @since Java Persistence 1.0 29 | */ 30 | @Target({TYPE}) 31 | @Retention(RUNTIME) 32 | 33 | public @interface ExcludeSuperclassListeners { 34 | } 35 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/FetchType.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | /** 19 | * Defines strategies for fetching data from the database. 20 | * The
EAGER
strategy is a requirement on the persistence
21 | * provider runtime that data must be eagerly fetched. The
22 | * LAZY
strategy is a hint to the persistence provider
23 | * runtime that data should be fetched lazily when it is
24 | * first accessed. The implementation is permitted to eagerly
25 | * fetch data for which the LAZY
strategy hint has been
26 | * specified.
27 | *
28 | * 29 | * Example: 30 | * @Basic(fetch=LAZY) 31 | * protected String getName() { return name; } 32 | *33 | * 34 | * @see Basic 35 | * @see ElementCollection 36 | * @see ManyToMany 37 | * @see OneToMany 38 | * @see ManyToOne 39 | * @see OneToOne 40 | * @since Java Persistence 1.0 41 | */ 42 | public enum FetchType { 43 | 44 | /** Defines that data can be lazily fetched. */ 45 | LAZY, 46 | 47 | /** Defines that data must be eagerly fetched. */ 48 | EAGER 49 | } 50 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/FieldResult.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2014 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 21 | 22 | /** 23 | * Used in conjunction with the {@link EntityResult} annotation to map columns specified 24 | * in the SELECT list of a SQL query to the properties or fields of an entity class. 25 | * 26 | *
27 | * 28 | * Example: 29 | * Query q = em.createNativeQuery( 30 | * "SELECT o.id AS order_id, " + 31 | * "o.quantity AS order_quantity, " + 32 | * "o.item AS order_item, " + 33 | * "FROM Order o, Item i " + 34 | * "WHERE (order_quantity > 25) AND (order_item = i.id)", 35 | * "OrderResults"); 36 | * 37 | * @SqlResultSetMapping(name="OrderResults", 38 | * entities={ 39 | * @EntityResult(entityClass=com.acme.Order.class, fields={ 40 | * @FieldResult(name="id", column="order_id"), 41 | * @FieldResult(name="quantity", column="order_quantity"), 42 | * @FieldResult(name="item", column="order_item")}) 43 | * }) 44 | *45 | * 46 | * @see EntityResult 47 | * @see SqlResultSetMapping 48 | * @since Java Persistence 1.0 49 | */ 50 | @Target({}) 51 | @Retention(RUNTIME) 52 | 53 | public @interface FieldResult { 54 | 55 | /** Name of the persistent field or property of the class. */ 56 | String name(); 57 | 58 | /** 59 | * Name of the column in the SELECT clause - i.e., column 60 | * aliases, if applicable. 61 | */ 62 | String column(); 63 | } 64 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/FlushModeType.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | /** 19 | * Flush mode setting. 20 | * 21 | *
When queries are executed within a transaction, if
22 | * FlushModeType.AUTO
is set on the {@link
23 | * javax.persistence.Query Query} or {@link javax.persistence.TypedQuery
24 | * TypedQuery} object, or if the flush mode setting for the
25 | * persistence context is AUTO
(the default) and a flush
26 | * mode setting has not been specified for the Query
or
27 | * TypedQuery
object, the persistence provider is
28 | * responsible for ensuring that all updates to the state of all
29 | * entities in the persistence context which could potentially affect
30 | * the result of the query are visible to the processing of the
31 | * query. The persistence provider implementation may achieve this by
32 | * flushing those entities to the database or by some other means.
33 | *
If FlushModeType.COMMIT
is set, the effect of
34 | * updates made to entities in the persistence context upon queries is
35 | * unspecified.
36 | *
37 | *
If there is no transaction active or the persistence context is not
38 | * joined to the current transaction, the persistence provider must not flush
39 | * to the database.
40 | *
41 | * @since Java Persistence 1.0
42 | */
43 | public enum FlushModeType {
44 |
45 | /** Flushing to occur at transaction commit. The provider may flush
46 | * at other times, but is not required to.
47 | */
48 | COMMIT,
49 |
50 | /** (Default) Flushing to occur at query execution. */
51 | AUTO
52 | }
53 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/GenerationType.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Defines the types of primary key generation strategies.
20 | *
21 | * @see GeneratedValue
22 | *
23 | * @since Java Persistence 1.0
24 | */
25 | public enum GenerationType {
26 |
27 | /**
28 | * Indicates that the persistence provider must assign
29 | * primary keys for the entity using an underlying
30 | * database table to ensure uniqueness.
31 | */
32 | TABLE,
33 |
34 | /**
35 | * Indicates that the persistence provider must assign
36 | * primary keys for the entity using a database sequence.
37 | */
38 | SEQUENCE,
39 |
40 | /**
41 | * Indicates that the persistence provider must assign
42 | * primary keys for the entity using a database identity column.
43 | */
44 | IDENTITY,
45 |
46 | /**
47 | * Indicates that the persistence provider should pick an
48 | * appropriate strategy for the particular database. The
49 | * AUTO
generation strategy may expect a database
50 | * resource to exist, or it may attempt to create one. A vendor
51 | * may provide documentation on how to create such resources
52 | * in the event that it does not support schema generation
53 | * or cannot create the schema resource at runtime.
54 | */
55 | AUTO
56 | }
57 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/Id.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.FIELD;
21 | import static java.lang.annotation.ElementType.METHOD;
22 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
23 |
24 | /**
25 | * Specifies the primary key of an entity.
26 | * The field or property to which the Id
annotation is applied
27 | * should be one of the following types: any Java primitive type;
28 | * any primitive wrapper type;
29 | * String
;
30 | * java.util.Date
;
31 | * java.sql.Date
;
32 | * java.math.BigDecimal
;
33 | * java.math.BigInteger
.
34 | *
35 | *
The mapped column for the primary key of the entity is assumed
36 | * to be the primary key of the primary table. If no Column
annotation
37 | * is specified, the primary key column name is assumed to be the name
38 | * of the primary key property or field.
39 | *
40 | *
41 | * Example: 42 | * 43 | * @Id 44 | * public Long getId() { return id; } 45 | *46 | * 47 | * @see Column 48 | * @see GeneratedValue 49 | * 50 | * @since Java Persistence 1.0 51 | */ 52 | @Target({METHOD, FIELD}) 53 | @Retention(RUNTIME) 54 | 55 | public @interface Id {} 56 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/IdClass.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.TYPE; 21 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 | 23 | /** 24 | * Specifies a composite primary key class that is mapped to 25 | * multiple fields or properties of the entity. 26 | * 27 | *
The names of the fields or properties in the primary key 28 | * class and the primary key fields or properties of the entity 29 | * must correspond and their types must be the same. 30 | * 31 | *
32 | * 33 | * Example: 34 | * 35 | * @IdClass(com.acme.EmployeePK.class) 36 | * @Entity 37 | * public class Employee { 38 | * @Id String empName; 39 | * @Id Date birthDay; 40 | * ... 41 | * } 42 | *43 | * 44 | * @since Java Persistence 1.0 45 | */ 46 | @Target({TYPE}) 47 | @Retention(RUNTIME) 48 | 49 | public @interface IdClass { 50 | 51 | /** Primary key class */ 52 | Class value(); 53 | } 54 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/Index.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * 14 | ******************************************************************************/ 15 | package javax.persistence; 16 | 17 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 18 | import java.lang.annotation.Retention; 19 | import java.lang.annotation.Target; 20 | 21 | /** 22 | * Used in schema generation to specify creation of an index. 23 | *
24 | * Note that it is not necessary to specify an index for a primary key, 25 | * as the primary key index will be created automatically. 26 | * 27 | *
28 | * The syntax of the columnList
element is a
29 | * column_list
, as follows:
30 | *
31 | *
32 | * column::= index_column [,index_column]* 33 | * index_column::= column_name [ASC | DESC] 34 | *35 | * 36 | *
If ASC
or DESC
is not specified,
37 | * ASC
(ascending order) is assumed.
38 | *
39 | * @see Table
40 | * @see SecondaryTable
41 | * @see CollectionTable
42 | * @see JoinTable
43 | * @see TableGenerator
44 | *
45 | * @since Java Persistence 2.1
46 | *
47 | */
48 | @Target({})
49 | @Retention(RUNTIME)
50 | public @interface Index {
51 |
52 | /**
53 | * (Optional) The name of the index; defaults to a provider-generated name.
54 | */
55 | String name() default "";
56 |
57 | /**
58 | * (Required) The names of the columns to be included in the index,
59 | * in order.
60 | */
61 | String columnList();
62 |
63 | /**
64 | * (Optional) Whether the index is unique.
65 | */
66 | boolean unique() default false;
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/Inheritance.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2014 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.TYPE;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 | import static javax.persistence.InheritanceType.SINGLE_TABLE;
23 |
24 | /**
25 | * Specifies the inheritance strategy to be used for an entity class
26 | * hierarchy. It is specified on the entity class that is the root of
27 | * the entity class hierarchy. If the Inheritance
annotation is not
28 | * specified or if no inheritance type is specified for an entity
29 | * class hierarchy, the SINGLE_TABLE
mapping strategy is used.
30 | *
31 | *
32 | * 33 | * Example: 34 | * 35 | * @Entity 36 | * @Inheritance(strategy=JOINED) 37 | * public class Customer { ... } 38 | * 39 | * @Entity 40 | * public class ValuedCustomer extends Customer { ... } 41 | *42 | * 43 | * @since Java Persistence 1.0 44 | */ 45 | @Target({TYPE}) 46 | @Retention(RUNTIME) 47 | 48 | public @interface Inheritance { 49 | 50 | /** The strategy to be used for the entity inheritance hierarchy. */ 51 | InheritanceType strategy() default SINGLE_TABLE; 52 | } 53 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/InheritanceType.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | /** 19 | * Defines inheritance strategy options. 20 | * 21 | * @since Java Persistence 1.0 22 | */ 23 | public enum InheritanceType { 24 | 25 | /** A single table per class hierarchy. */ 26 | SINGLE_TABLE, 27 | 28 | /** A table per concrete entity class. */ 29 | TABLE_PER_CLASS, 30 | 31 | /** 32 | * A strategy in which fields that are specific to a 33 | * subclass are mapped to a separate table than the fields 34 | * that are common to the parent class, and a join is 35 | * performed to instantiate the subclass. 36 | */ 37 | JOINED 38 | } 39 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/Lob.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.FIELD; 21 | import static java.lang.annotation.ElementType.METHOD; 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 23 | 24 | /** 25 | * Specifies that a persistent property or field should be persisted 26 | * as a large object to a database-supported large object type. 27 | * 28 | *
Portable applications should use the Lob
annotation
29 | * when mapping to a database Lob type. The Lob
30 | * annotation may be used in conjunction with the {@link Basic}
31 | * annotation or the {@link ElementCollection} annotation when the
32 | * element collection value is of basic type. A Lob
may
33 | * be either a binary or character type.
34 | *
35 | *
The Lob
type is inferred from the type of the
36 | * persistent field or property, and except for string and
37 | * character-based types defaults to Blob.
38 | *
39 | * 40 | * Example 1: 41 | * 42 | * @Lob @Basic(fetch=LAZY) 43 | * @Column(name="REPORT") 44 | * protected String report; 45 | * 46 | * Example 2: 47 | * 48 | * @Lob @Basic(fetch=LAZY) 49 | * @Column(name="EMP_PIC", columnDefinition="BLOB NOT NULL") 50 | * protected byte[] pic; 51 | * 52 | *53 | * 54 | * @see Basic 55 | * @see ElementCollection 56 | * 57 | * @since Java Persistence 1.0 58 | */ 59 | @Target({METHOD, FIELD}) 60 | @Retention(RUNTIME) 61 | public @interface Lob { 62 | } 63 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/MapKeyEnumerated.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.FIELD; 21 | import static java.lang.annotation.ElementType.METHOD; 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 23 | import static javax.persistence.EnumType.ORDINAL; 24 | 25 | /** 26 | * Specifies the enum type for a map key whose basic type is an enumerated type. 27 | * 28 | * The
MapKeyEnumerated
annotation can be applied to an
29 | * element collection or relationship of type java.util.Map
, in
30 | * conjunction with the ElementCollection
, OneToMany
, or
31 | * ManyToMany
annotation.
32 | * If the enumerated type is not specified or the MapKeyEnumerated
33 | * annotation is not used, the enumerated type is assumed to be
34 | * ORDINAL
.
35 | *
36 | * 37 | * Example: 38 | * 39 | * public enum ProjectStatus {COMPLETE, DELAYED, CANCELLED, IN_PROGRESS} 40 | * 41 | * public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE} 42 | * 43 | * @Entity public class Employee { 44 | * @ManyToMany 45 | * public Projects<ProjectStatus, Project> getProjects() {...} 46 | * 47 | * @OneToMany 48 | * @MapKeyEnumerated(STRING) 49 | * public Map<SalaryRate, Employee> getEmployees() {...} 50 | * ... 51 | * } 52 | *53 | * 54 | * @see ElementCollection 55 | * @see OneToMany 56 | * @see ManyToMany 57 | * 58 | * @since Java Persistence 2.0 59 | */ 60 | @Target({METHOD, FIELD}) @Retention(RUNTIME) 61 | public @interface MapKeyEnumerated { 62 | 63 | /** (Optional) The type used in mapping a map key enum type. */ 64 | EnumType value() default ORDINAL; 65 | } 66 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/MapKeyJoinColumns.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.FIELD; 21 | import static java.lang.annotation.ElementType.METHOD; 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 23 | import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT; 24 | 25 | /** 26 | * Supports composite map keys that reference entities. 27 | *
The MapKeyJoinColumns
annotation groups
28 | * MapKeyJoinColumn
annotations. When the
29 | * MapKeyJoinColumns
annotation is used, both the
30 | * name
and the referencedColumnName
31 | * elements must be specified in each of the grouped
32 | * MapKeyJoinColumn
annotations.
33 | *
34 | * @see MapKeyJoinColumn
35 | * @see ForeignKey
36 | *
37 | * @since Java Persistence 2.0
38 | */
39 | @Target( { METHOD, FIELD })
40 | @Retention(RUNTIME)
41 | public @interface MapKeyJoinColumns {
42 | /**
43 | * (Required) The map key join columns that are used to map to the entity
44 | * that is the map key.
45 | */
46 | MapKeyJoinColumn[] value();
47 |
48 | /**
49 | * (Optional) Used to specify or control the generation of a
50 | * foreign key constraint when table generation is in effect.
51 | * If both this element and the foreignKey
52 | * element of any of the MapKeyJoinColumn
53 | * elements are specified, the behavior is undefined. If no
54 | * foreign key annotation element is specified in either
55 | * location, the persistence provider's default foreign key
56 | * strategy will apply.
57 | *
58 | * @since Java Persistence 2.1
59 | */
60 | ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT);
61 | }
62 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/MapKeyTemporal.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.FIELD;
21 | import static java.lang.annotation.ElementType.METHOD;
22 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
23 |
24 | /**
25 | * This annotation must be specified for persistent map keys of type
26 | * {@link java.util.Date} and {@link java.util.Calendar}. It may only be
27 | * specified for map keys of these types.
28 | *
29 | *
The MapKeyTemporal
annotation can be applied to an
30 | * element collection or relationship of type java.util.Map
31 | * in conjunction with the ElementCollection
,
32 | * OneToMany
, or ManyToMany
annotation.
33 | *
34 | *
35 | * Example: 36 | * 37 | * @OneToMany 38 | * @MapKeyTemporal(DATE) 39 | * protected java.util.Map<java.util.Date, Employee> employees; 40 | *41 | * 42 | * @since Java Persistence 2.0 43 | */ 44 | @Target({METHOD, FIELD}) 45 | @Retention(RUNTIME) 46 | public @interface MapKeyTemporal { 47 | 48 | /** (Required) The type used in mapping 49 | *
java.util.Date
or
50 | * java.util.Calendar
.
51 | */
52 | TemporalType value();
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/NamedEntityGraph.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 - 2015 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Petros Splinakis - Java Persistence 2.2
13 | * Linda DeMichiel - Java Persistence 2.1
14 | *
15 | ******************************************************************************/
16 |
17 | package javax.persistence;
18 |
19 | import java.lang.annotation.Repeatable;
20 | import java.lang.annotation.Target;
21 | import java.lang.annotation.Retention;
22 | import static java.lang.annotation.ElementType.TYPE;
23 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
24 |
25 | /**
26 | * Used to specify the path and boundaries for a find operation or query.
27 | *
28 | * @since Java Persistence 2.1
29 | */
30 | @Repeatable(NamedEntityGraphs.class)
31 | @Target({TYPE})
32 | @Retention(RUNTIME)
33 | public @interface NamedEntityGraph {
34 |
35 | /**
36 | * (Optional) The name of the entity graph.
37 | * Defaults to the entity name of the root entity.
38 | */
39 | String name() default "";
40 |
41 | /**
42 | * (Optional) A list of attributes of the entity that are included in
43 | * this graph.
44 | */
45 | NamedAttributeNode[] attributeNodes() default {};
46 |
47 | /**
48 | * (Optional) Includes all of the attributes of the annotated
49 | * entity class as attribute nodes in the NamedEntityGraph without
50 | * the need to explicitly list them. Included attributes can
51 | * still be fully specified by an attribute node referencing a
52 | * subgraph.
53 | */
54 | boolean includeAllAttributes() default false;
55 |
56 | /**
57 | * (Optional) A list of subgraphs that are included in the
58 | * entity graph. These are referenced by name from NamedAttributeNode
59 | * definitions.
60 | */
61 | NamedSubgraph[] subgraphs() default {};
62 |
63 | /**
64 | * (Optional) A list of subgraphs that will add additional
65 | * attributes for subclasses of the annotated entity class to the
66 | * entity graph. Specified attributes from superclasses are
67 | * included in subclasses.
68 | */
69 | NamedSubgraph[] subclassSubgraphs() default {};
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/NamedEntityGraphs.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | *
14 | ******************************************************************************/
15 |
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.TYPE;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Used to group NamedEntityGraph
annotations.
25 | *
26 | * @see NamedEntityGraph
27 | * @since Java Persistence 2.1
28 | */
29 | @Target({TYPE})
30 | @Retention(RUNTIME)
31 | public @interface NamedEntityGraphs{
32 | NamedEntityGraph[] value();
33 | }
34 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/NamedNativeQueries.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.TYPE;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies multiple native SQL named queries. Query names
25 | * are scoped to the persistence unit. The NamedNativeQueries
26 | * annotation can be applied to an entity or mapped superclass.
27 | *
28 | * @see NamedNativeQuery
29 | *
30 | * @since Java Persistence 1.0
31 | */
32 | @Target({TYPE})
33 | @Retention(RUNTIME)
34 | public @interface NamedNativeQueries {
35 |
36 | /** (Required) Array of NamedNativeQuery
annotations. */
37 | NamedNativeQuery[] value ();
38 | }
39 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/NamedNativeQuery.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2015 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Petros Splinakis - Java Persistence 2.2
13 | * Linda DeMichiel - Java Persistence 2.1
14 | * Linda DeMichiel - Java Persistence 2.0
15 | *
16 | ******************************************************************************/
17 | package javax.persistence;
18 |
19 | import java.lang.annotation.Repeatable;
20 | import java.lang.annotation.Target;
21 | import java.lang.annotation.Retention;
22 | import static java.lang.annotation.ElementType.TYPE;
23 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
24 |
25 | /**
26 | * Specifies a named native SQL query.
27 | * Query names are scoped to the persistence unit.
28 | * The NamedNativeQuery
annotation can be applied to an
29 | * entity or mapped superclass.
30 | *
31 | * @since Java Persistence 1.0
32 | */
33 | @Repeatable(NamedNativeQueries.class)
34 | @Target({TYPE})
35 | @Retention(RUNTIME)
36 | public @interface NamedNativeQuery {
37 |
38 | /**
39 | * The name used to refer to the query with the {@link EntityManager}
40 | * methods that create query objects.
41 | */
42 | String name();
43 |
44 | /** The SQL query string. */
45 | String query();
46 |
47 | /** Query properties and hints. (May include vendor-specific query hints.) */
48 | QueryHint[] hints() default {};
49 |
50 | /** The class of the result. */
51 | Class resultClass() default void.class;
52 |
53 | /** The name of a {@link SqlResultSetMapping}, as defined in metadata. */
54 | String resultSetMapping() default "";
55 | }
56 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/NamedQueries.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.TYPE;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies multiple named Java Persistence query language queries.
25 | * Query names are scoped to the persistence unit.
26 | * The NamedQueries
annotation can be applied to an entity or mapped superclass.
27 | *
28 | * @see NamedQuery
29 | *
30 | * @since Java Persistence 1.0
31 | */
32 | @Target({TYPE})
33 | @Retention(RUNTIME)
34 | public @interface NamedQueries {
35 |
36 | /** (Required) An array of NamedQuery
annotations. */
37 | NamedQuery [] value ();
38 | }
39 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/NamedStoredProcedureQueries.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | *
14 | ******************************************************************************/
15 | package javax.persistence;
16 |
17 | import java.lang.annotation.Target;
18 | import java.lang.annotation.Retention;
19 | import static java.lang.annotation.ElementType.TYPE;
20 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
21 |
22 | /**
23 | * Specifies multiple named stored procedure queries. Query names
24 | * are scoped to the persistence unit. The NamedStoredProcedureQueries
25 | * annotation can be applied to an entity or mapped superclass.
26 | *
27 | * @see NamedStoredProcedureQuery
28 | *
29 | * @since Java Persistence 2.1
30 | */
31 | @Target({TYPE})
32 | @Retention(RUNTIME)
33 | public @interface NamedStoredProcedureQueries {
34 |
35 | /** (Required) Array of NamedStoredProcedureQuery
annotations. */
36 | NamedStoredProcedureQuery[] value ();
37 | }
38 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/NamedSubgraph.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | *
14 | ******************************************************************************/
15 |
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
21 |
22 | /**
23 | * A NamedSubgraph
is a member element of a
24 | * NamedEntityGraph
. The NamedSubgraph
is
25 | * only referenced from within a NamedEntityGraph and can not be
26 | * referenced independently. It is referenced by its name
27 | * from a NamedAttributeNode
element of the
28 | * NamedEntityGraph
.
29 | *
30 | * @see NamedEntityGraph
31 | * @see NamedAttributeNode
32 | *
33 | * @since Java Persistence 2.1
34 | */
35 | @Target({})
36 | @Retention(RUNTIME)
37 | public @interface NamedSubgraph {
38 |
39 | /**
40 | * (Required) The name of the subgraph as referenced from a
41 | * NamedAttributeNode element.
42 | */
43 | String name();
44 |
45 | /**
46 | * (Optional) The type represented by this subgraph. The element
47 | * must be specified when this subgraph is extending a definition
48 | * on behalf of a subclass.
49 | */
50 | Class type() default void.class;
51 |
52 | /**
53 | * (Required) The list of the attributes of the class that must
54 | * be included. If the named subgraph corresponds to a subclass
55 | * of the class referenced by the corresponding attribute node,
56 | * then only subclass-specific attributes are listed.
57 | */
58 | NamedAttributeNode[] attributeNodes();
59 | }
60 |
61 |
62 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/NoResultException.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Thrown by the persistence provider when {@link
20 | * Query#getSingleResult Query.getSingleResult()} or {@link
21 | * TypedQuery#getSingleResult TypedQuery.getSingleResult()}is executed on a query
22 | * and there is no result to return. This exception will not cause
23 | * the current transaction, if one is active, to be marked for
24 | * rollback.
25 | *
26 | * @see Query#getSingleResult()
27 | * @see TypedQuery#getSingleResult()
28 | *
29 | * @since Java Persistence 1.0
30 | */
31 | public class NoResultException extends PersistenceException {
32 |
33 | /**
34 | * Constructs a new NoResultException
exception with
35 | * null
as its detail message.
36 | */
37 | public NoResultException() {
38 | super();
39 | }
40 |
41 | /**
42 | * Constructs a new NoResultException
exception with the
43 | * specified detail message.
44 | *
45 | * @param message
46 | * the detail message.
47 | */
48 | public NoResultException(String message) {
49 | super(message);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/NonUniqueResultException.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Thrown by the persistence provider when {@link
20 | * Query#getSingleResult Query.getSingleResult()} or {@link
21 | * TypedQuery#getSingleResult TypedQuery.getSingleResult()} is executed on a
22 | * query and there is more than one result from the query. This
23 | * exception will not cause the current transaction, if one is active,
24 | * to be marked for rollback.
25 | *
26 | * @see Query#getSingleResult()
27 | * @see TypedQuery#getSingleResult()
28 | *
29 | * @since Java Persistence 1.0
30 | */
31 | public class NonUniqueResultException extends PersistenceException {
32 |
33 | /**
34 | * Constructs a new NonUniqueResultException
exception
35 | * with null
as its detail message.
36 | */
37 | public NonUniqueResultException() {
38 | super();
39 | }
40 |
41 | /**
42 | * Constructs a new NonUniqueResultException
exception
43 | * with the specified detail message.
44 | * @param message the detail message.
45 | */
46 | public NonUniqueResultException(String message) {
47 | super(message);
48 | }
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/Parameter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Type for query parameter objects.
20 | * @param PersistenceContext
annotations. */
37 | PersistenceContext[] value();
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PersistenceException.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 |
19 | /**
20 | * Thrown by the persistence provider when a problem occurs.
21 | * All instances of PersistenceException
except for instances of
22 | * {@link NoResultException}, {@link NonUniqueResultException},
23 | * {@link LockTimeoutException}, and {@link QueryTimeoutException} will cause
24 | * the current transaction, if one is active and the persistence context has
25 | * been joined to it, to be marked for rollback.
26 | *
27 | * @since Java Persistence 1.0
28 | */
29 | public class PersistenceException extends RuntimeException {
30 |
31 | /**
32 | * Constructs a new PersistenceException
exception
33 | * with null
as its detail message.
34 | */
35 | public PersistenceException() {
36 | super();
37 | }
38 |
39 | /**
40 | * Constructs a new PersistenceException
exception
41 | * with the specified detail message.
42 | * @param message the detail message.
43 | */
44 | public PersistenceException(String message) {
45 | super(message);
46 | }
47 |
48 | /**
49 | * Constructs a new PersistenceException
exception
50 | * with the specified detail message and cause.
51 | * @param message the detail message.
52 | * @param cause the cause.
53 | */
54 | public PersistenceException(String message, Throwable cause) {
55 | super(message, cause);
56 | }
57 |
58 | /**
59 | * Constructs a new PersistenceException
exception
60 | * with the specified cause.
61 | * @param cause the cause.
62 | */
63 | public PersistenceException(Throwable cause) {
64 | super(cause);
65 | }
66 | }
67 |
68 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PersistenceProperty.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.RetentionPolicy.*;
21 |
22 | /**
23 | * Describes a single container or persistence provider property. Used in {@link
24 | * PersistenceContext}.
25 | *
26 | * Vendor specific properties may be included in the set of
27 | * properties, and are passed to the persistence provider by the
28 | * container when the entity manager is created. Properties that
29 | * are not recognized by a vendor will be ignored.
30 | *
31 | * @since Java Persistence 1.0
32 | */
33 | @Target({})
34 | @Retention(RUNTIME)
35 | public @interface PersistenceProperty {
36 |
37 | /** The name of the property */
38 | String name();
39 |
40 | /** The value of the property */
41 | String value();
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PersistenceUnit.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2015 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Petros Splinakis - Java Persistence 2.2
13 | * Linda DeMichiel - Java Persistence 2.1
14 | * Linda DeMichiel - Java Persistence 2.0
15 | *
16 | ******************************************************************************/
17 | package javax.persistence;
18 |
19 | import java.lang.annotation.Repeatable;
20 | import java.lang.annotation.Target;
21 | import static java.lang.annotation.ElementType.*;
22 | import java.lang.annotation.Retention;
23 | import static java.lang.annotation.RetentionPolicy.*;
24 |
25 |
26 | /**
27 | * Expresses a dependency on an {@link EntityManagerFactory} and its
28 | * associated persistence unit.
29 | *
30 | * @since Java Persistence 1.0
31 | */
32 | @Repeatable(PersistenceUnits.class)
33 | @Target({TYPE, METHOD, FIELD})
34 | @Retention(RUNTIME)
35 | public @interface PersistenceUnit {
36 |
37 | /**
38 | * (Optional) The name by which the entity manager factory is to be accessed
39 | * in the environment referencing context; not needed when
40 | * dependency injection is used.
41 | */
42 | String name() default "";
43 |
44 | /**
45 | * (Optional) The name of the persistence unit as defined in the
46 | * persistence.xml
file. If specified, the
47 | * persistence unit for the entity manager factory that is
48 | * accessible in JNDI must have the same name.
49 | */
50 | String unitName() default "";
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PersistenceUnits.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import static java.lang.annotation.ElementType.*;
20 | import java.lang.annotation.Retention;
21 | import static java.lang.annotation.RetentionPolicy.*;
22 |
23 |
24 | /**
25 | * Declares one or more {@link PersistenceUnit} annotations.
26 | *
27 | * @since Java Persistence 1.0
28 | */
29 |
30 | @Target({TYPE})
31 | @Retention(RUNTIME)
32 | public @interface PersistenceUnits {
33 |
34 | /** (Required) One or more {@link PersistenceUnit} annotations. */
35 | PersistenceUnit[] value();
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PersistenceUtil.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Utility interface between the application and the persistence
20 | * provider(s).
21 | *
22 | *
The PersistenceUtil
interface instance obtained from the
23 | * {@link Persistence} class is used to determine the load state of an
24 | * entity or entity attribute regardless of which persistence
25 | * provider in the environment created the entity.
26 | *
27 | * @since Java Persistence 2.0
28 | */
29 | public interface PersistenceUtil {
30 |
31 | /**
32 | * Determine the load state of a given persistent attribute.
33 | * @param entity entity containing the attribute
34 | * @param attributeName name of attribute whose load state is
35 | * to be determined
36 | * @return false if entity's state has not been loaded or
37 | * if the attribute state has not been loaded, else true
38 | */
39 | public boolean isLoaded(Object entity, String attributeName);
40 |
41 | /**
42 | * Determine the load state of an entity.
43 | * This method can be used to determine the load state
44 | * of an entity passed as a reference. An entity is
45 | * considered loaded if all attributes for which
46 | * FetchType.EAGER
has been specified have been loaded.
47 | *
The isLoaded(Object, String)
method should be used to
48 | * determine the load state of an attribute.
49 | * Not doing so might lead to unintended loading of state.
50 | * @param entity whose load state is to be determined
51 | * @return false if the entity has not been loaded, else true
52 | */
53 | public boolean isLoaded(Object entity);
54 | }
55 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PostLoad.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies a callback method for the corresponding
25 | * lifecycle event. This annotation may be applied to methods
26 | * of an entity class, a mapped superclass, or a callback
27 | * listener class.
28 | *
29 | * @since Java Persistence 1.0
30 | */
31 | @Target({METHOD})
32 | @Retention(RUNTIME)
33 |
34 | public @interface PostLoad {}
35 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PostPersist.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies a callback method for the corresponding
25 | * lifecycle event. This annotation may be applied to methods
26 | * of an entity class, a mapped superclass, or a callback
27 | * listener class.
28 | *
29 | * @since Java Persistence 1.0
30 | */
31 | @Target({METHOD})
32 | @Retention(RUNTIME)
33 |
34 | public @interface PostPersist {}
35 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PostRemove.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies a callback method for the corresponding
25 | * lifecycle event. This annotation may be applied to methods
26 | * of an entity class, a mapped superclass, or a callback
27 | * listener class.
28 | *
29 | * @since Java Persistence 1.0
30 | */
31 | @Target({METHOD})
32 | @Retention(RUNTIME)
33 |
34 | public @interface PostRemove {}
35 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PostUpdate.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies a callback method for the corresponding
25 | * lifecycle event. This annotation may be applied to methods
26 | * of an entity class, a mapped superclass, or a callback
27 | * listener class.
28 | *
29 | * @since Java Persistence 1.0
30 | */
31 | @Target({METHOD})
32 | @Retention(RUNTIME)
33 |
34 | public @interface PostUpdate {}
35 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PrePersist.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies a callback method for the corresponding
25 | * lifecycle event. This annotation may be applied to methods
26 | * of an entity class, a mapped superclass, or a callback
27 | * listener class.
28 | *
29 | * @since Java Persistence 1.0
30 | */
31 | @Target({METHOD})
32 | @Retention(RUNTIME)
33 |
34 | public @interface PrePersist {}
35 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PreRemove.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies a callback method for the corresponding
25 | * lifecycle event. This annotation may be applied to methods
26 | * of an entity class, a mapped superclass, or a callback
27 | * listener class.
28 | *
29 | * @since Java Persistence 1.0
30 | */
31 | @Target({METHOD})
32 | @Retention(RUNTIME)
33 |
34 | public @interface PreRemove {}
35 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PreUpdate.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies a callback method for the corresponding
25 | * lifecycle event. This annotation may be applied to methods
26 | * of an entity class, a mapped superclass, or a callback
27 | * listener class.
28 | *
29 | * @since Java Persistence 1.0
30 | */
31 | @Target({METHOD})
32 | @Retention(RUNTIME)
33 |
34 | public @interface PreUpdate {}
35 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/PrimaryKeyJoinColumns.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.ElementType.FIELD;
22 | import static java.lang.annotation.ElementType.TYPE;
23 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
24 | import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT;
25 |
26 | /**
27 | * Groups {@link PrimaryKeyJoinColumn} annotations.
28 | * It is used to map composite foreign keys.
29 | *
30 | *
31 | * Example: ValuedCustomer subclass 32 | * 33 | * @Entity 34 | * @Table(name="VCUST") 35 | * @DiscriminatorValue("VCUST") 36 | * @PrimaryKeyJoinColumns({ 37 | * @PrimaryKeyJoinColumn(name="CUST_ID", 38 | * referencedColumnName="ID"), 39 | * @PrimaryKeyJoinColumn(name="CUST_TYPE", 40 | * referencedColumnName="TYPE") 41 | * }) 42 | * public class ValuedCustomer extends Customer { ... } 43 | *44 | * 45 | * @see ForeignKey 46 | * 47 | * @since Java Persistence 1.0 48 | */ 49 | @Target({TYPE, METHOD, FIELD}) 50 | @Retention(RUNTIME) 51 | 52 | public @interface PrimaryKeyJoinColumns { 53 | 54 | /** One or more
PrimaryKeyJoinColumn
annotations. */
55 | PrimaryKeyJoinColumn[] value();
56 |
57 | /**
58 | * (Optional) Used to specify or control the generation of a
59 | * foreign key constraint when table generation is in effect.
60 | * If both this element and the foreignKey
element
61 | * of any of the PrimaryKeyJoinColumn
elements are specified,
62 | * the behavior is undefined. If no foreign key annotation element
63 | * is specified in either location, the persistence provider's
64 | * default foreign key strategy will apply.
65 | *
66 | * @since Java Persistence 2.1
67 | */
68 | ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT);
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/QueryHint.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
21 |
22 | /**
23 | * Used to supply a query property or hint to the {@link NamedQuery} or {@link
24 | * NamedNativeQuery} annotation.
25 | *
26 | * Vendor-specific hints that are not recognized by a provider are ignored.
27 | *
28 | * @since Java Persistence 1.0
29 | */
30 | @Target({})
31 | @Retention(RUNTIME)
32 | public @interface QueryHint {
33 |
34 | /** Name of the hint. */
35 | String name();
36 |
37 | /** Value of the hint. */
38 | String value();
39 | }
40 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/RollbackException.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 | /**
18 | * Thrown by the persistence provider when
19 | * {@link EntityTransaction#commit() EntityTransaction.commit()} fails.
20 | *
21 | * @see javax.persistence.EntityTransaction#commit()
22 | *
23 | * @since Java Persistence 1.0
24 | */
25 | public class RollbackException extends PersistenceException {
26 |
27 | /**
28 | * Constructs a new RollbackException
exception
29 | * with null
as its detail message.
30 | */
31 | public RollbackException() {
32 | super();
33 | }
34 |
35 | /**
36 | * Constructs a new RollbackException
exception
37 | * with the specified detail message.
38 | * @param message the detail message.
39 | */
40 | public RollbackException(String message) {
41 | super(message);
42 | }
43 |
44 | /**
45 | * Constructs a new RollbackException
exception
46 | * with the specified detail message and cause.
47 | * @param message the detail message.
48 | * @param cause the cause.
49 | */
50 | public RollbackException(String message, Throwable cause) {
51 | super(message, cause);
52 | }
53 |
54 | /**
55 | * Constructs a new RollbackException
exception
56 | * with the specified cause.
57 | * @param cause the cause.
58 | */
59 | public RollbackException(Throwable cause) {
60 | super(cause);
61 | }
62 | }
63 |
64 |
65 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/SecondaryTables.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.TYPE;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Specifies multiple secondary tables for an entity.
25 | *
26 | *
27 | * Example 1: Multiple secondary tables assuming primary key columns are named the same in all tables. 28 | * 29 | * @Entity 30 | * @Table(name="EMPLOYEE") 31 | * @SecondaryTables({ 32 | * @SecondaryTable(name="EMP_DETAIL"), 33 | * @SecondaryTable(name="EMP_HIST") 34 | * }) 35 | * public class Employee { ... } 36 | * 37 | * 38 | * Example 2: Multiple secondary tables with differently named primary key columns. 39 | * 40 | * @Entity 41 | * @Table(name="EMPLOYEE") 42 | * @SecondaryTables({ 43 | * @SecondaryTable(name="EMP_DETAIL", 44 | * pkJoinColumns=@PrimaryKeyJoinColumn(name="EMPL_ID")), 45 | * @SecondaryTable(name="EMP_HIST", 46 | * pkJoinColumns=@PrimaryKeyJoinColumn(name="EMPLOYEE_ID")) 47 | * }) 48 | * public class Employee { ... } 49 | *50 | * 51 | * @since Java Persistence 1.0 52 | */ 53 | @Target(TYPE) 54 | @Retention(RUNTIME) 55 | 56 | public @interface SecondaryTables { 57 | 58 | /** (Required) The secondary tables for an entity. */ 59 | SecondaryTable[] value(); 60 | } 61 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/SequenceGenerators.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Lukas Jungmann - Java Persistence 2.2 13 | * 14 | ******************************************************************************/ 15 | package javax.persistence; 16 | 17 | import static java.lang.annotation.ElementType.FIELD; 18 | import static java.lang.annotation.ElementType.METHOD; 19 | import static java.lang.annotation.ElementType.TYPE; 20 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 21 | 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * Used to group
SequenceGenerator
annotations.
27 | *
28 | * @see SequenceGenerator
29 | * @since Java Persistence 2.2
30 | */
31 | @Target({TYPE, METHOD, FIELD})
32 | @Retention(RUNTIME)
33 | public @interface SequenceGenerators {
34 |
35 | SequenceGenerator[] value();
36 | }
37 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/SharedCacheMode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2014 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Specifies how the provider must use a second-level cache for the
20 | * persistence unit. Corresponds to the value of the persistence.xml
21 | * shared-cache-mode
element, and returned as the result of
22 | * {@link javax.persistence.spi.PersistenceUnitInfo#getSharedCacheMode()}.
23 | *
24 | * @since Java Persistence 2.0
25 | */
26 | public enum SharedCacheMode {
27 |
28 | /**
29 | * All entities and entity-related state and data are cached.
30 | */
31 | ALL,
32 |
33 | /**
34 | * Caching is disabled for the persistence unit.
35 | */
36 | NONE,
37 |
38 | /**
39 | * Caching is enabled for all entities for Cacheable(true)
40 | * is specified. All other entities are not cached.
41 | */
42 | ENABLE_SELECTIVE,
43 |
44 | /**
45 | * Caching is enabled for all entities except those for which
46 | * Cacheable(false)
is specified. Entities for which
47 | * Cacheable(false)
is specified are not cached.
48 | */
49 | DISABLE_SELECTIVE,
50 |
51 | /**
52 | *
53 | * Caching behavior is undefined: provider-specific defaults may apply.
54 | */
55 | UNSPECIFIED
56 | }
57 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/SqlResultSetMappings.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.TYPE;
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | /**
24 | * Is used to define one or more {@link SqlResultSetMapping} annotations.
25 | *
26 | * @since Java Persistence 1.0
27 | */
28 | @Target({TYPE})
29 | @Retention(RUNTIME)
30 | public @interface SqlResultSetMappings {
31 |
32 | /** One or more SqlResultSetMapping
annotations. */
33 | SqlResultSetMapping[] value();
34 | }
35 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/StoredProcedureParameter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | *
14 | ******************************************************************************/
15 | package javax.persistence;
16 |
17 | import java.lang.annotation.Target;
18 | import java.lang.annotation.Retention;
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | /**
22 | * Specifies a parameter of a named stored procedure query. All
23 | * parameters of a named stored procedure query must be specified.
24 | *
25 | * @see NamedStoredProcedureQuery
26 | * @see ParameterMode
27 | *
28 | * @since Java Persistence 2.1
29 | */
30 | @Target({})
31 | @Retention(RUNTIME)
32 | public @interface StoredProcedureParameter {
33 |
34 | /**
35 | * The name of the parameter as defined by the stored procedure in the database.
36 | * If a name is not specified, it is assumed that the stored procedure uses
37 | * positional parameters.
38 | */
39 | String name() default "";
40 |
41 | /**
42 | * Specifies whether the parameter is an IN, INOUT, OUT, or REF_CURSOR parameter.
43 | * REF_CURSOR parameters are used by some databases to return result sets from
44 | * a stored procedure.
45 | */
46 | ParameterMode mode() default ParameterMode.IN;
47 |
48 | /** JDBC type of the paramter. */
49 | Class type();
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/SynchronizationType.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | *
14 | ******************************************************************************/
15 | package javax.persistence;
16 |
17 | /**
18 | * Specifies whether the persistence context is always automatically
19 | * synchronized with the current transaction or whether the persistence context
20 | * must be explicitly joined to the current transaction by means of the
21 | * {@link EntityManager#joinTransaction} method.
22 | *
23 | * @since Java Persistence 2.1
24 | */
25 | public enum SynchronizationType {
26 |
27 | /** Persistence context is automatically synchronized with the current transaction */
28 | SYNCHRONIZED,
29 |
30 | /** Persistence context must be explicitly joined to the current transaction */
31 | UNSYNCHRONIZED,
32 | }
33 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/TableGenerators.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2017 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Lukas Jungmann - Java Persistence 2.2
13 | *
14 | ******************************************************************************/
15 | package javax.persistence;
16 |
17 | import static java.lang.annotation.ElementType.FIELD;
18 | import static java.lang.annotation.ElementType.METHOD;
19 | import static java.lang.annotation.ElementType.TYPE;
20 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
21 |
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Used to group TableGenerator
annotations.
27 | *
28 | * @see TableGenerator
29 | * @since Java Persistence 2.2
30 | */
31 | @Target({TYPE, METHOD, FIELD})
32 | @Retention(RUNTIME)
33 | public @interface TableGenerators {
34 |
35 | TableGenerator[] value();
36 | }
37 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/Temporal.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.FIELD;
21 | import static java.lang.annotation.ElementType.METHOD;
22 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
23 |
24 | /**
25 | * This annotation must be specified for persistent fields
26 | * or properties of type java.util.Date
and
27 | * java.util.Calendar
. It may only be specified for fields
28 | * or properties of these types.
29 | *
30 | * The Temporal
annotation may be used in
31 | * conjunction with the {@link Basic} annotation, the {@link Id}
32 | * annotation, or the {@link ElementCollection} annotation (when
33 | * the element collection value is of such a temporal type.
34 | *
35 | *
36 | * Example: 37 | * 38 | * @Temporal(DATE) 39 | * protected java.util.Date endDate; 40 | *41 | * 42 | * @since Java Persistence 1.0 43 | */ 44 | @Target({METHOD, FIELD}) 45 | @Retention(RUNTIME) 46 | public @interface Temporal { 47 | 48 | /** The type used in mapping
java.util.Date
or java.util.Calendar
. */
49 | TemporalType value();
50 | }
51 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/TemporalType.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Type used to indicate a specific mapping of java.util.Date
20 | * or java.util.Calendar
.
21 | *
22 | * @since Java Persistence 1.0
23 | */
24 | public enum TemporalType {
25 |
26 | /** Map as java.sql.Date
*/
27 | DATE,
28 |
29 | /** Map as java.sql.Time
*/
30 | TIME,
31 |
32 | /** Map as java.sql.Timestamp
*/
33 | TIMESTAMP
34 | }
35 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/TransactionRequiredException.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | /**
19 | * Thrown by the persistence provider when a transaction is required but is not
20 | * active.
21 | *
22 | * @since Java Persistence 1.0
23 | */
24 | public class TransactionRequiredException extends PersistenceException {
25 |
26 | /**
27 | * Constructs a new TransactionRequiredException
exception with
28 | * null
as its detail message.
29 | */
30 | public TransactionRequiredException() {
31 | super();
32 | }
33 |
34 | /**
35 | * Constructs a new TransactionRequiredException
exception with
36 | * the specified detail message.
37 | *
38 | * @param message
39 | * the detail message.
40 | */
41 | public TransactionRequiredException(String message) {
42 | super(message);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/Transient.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence;
17 |
18 | import java.lang.annotation.Target;
19 | import java.lang.annotation.Retention;
20 | import static java.lang.annotation.ElementType.METHOD;
21 | import static java.lang.annotation.ElementType.FIELD;
22 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
23 |
24 | /**
25 | * Specifies that the property or field is not persistent. It is used
26 | * to annotate a property or field of an entity class, mapped
27 | * superclass, or embeddable class.
28 | *
29 | * 30 | * Example: 31 | * 32 | * @Entity 33 | * public class Employee { 34 | * @Id int id; 35 | * @Transient User currentUser; 36 | * ... 37 | * } 38 | *39 | * 40 | * @since Java Persistence 1.0 41 | */ 42 | @Target({METHOD, FIELD}) 43 | @Retention(RUNTIME) 44 | 45 | public @interface Transient {} 46 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/TupleElement.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | /** 19 | * The
TupleElement
interface defines an element that is returned in
20 | * a query result tuple.
21 | * @param 27 | * Example: 28 | * @Entity 29 | * @Table( 30 | * name="EMPLOYEE", 31 | * uniqueConstraints= 32 | * @UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"}) 33 | * ) 34 | * public class Employee { ... } 35 | *36 | * 37 | * @since Java Persistence 1.0 38 | */ 39 | @Target({}) 40 | @Retention(RUNTIME) 41 | public @interface UniqueConstraint { 42 | 43 | /** (Optional) Constraint name. A provider-chosen name will be chosen 44 | * if a name is not specified. 45 | * 46 | * @since Java Persistence 2.0 47 | */ 48 | String name() default ""; 49 | 50 | /** (Required) An array of the column names that make up the constraint. */ 51 | String[] columnNames(); 52 | } 53 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/ValidationMode.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | /** 19 | * The validation mode to be used by the provider for the persistence 20 | * unit. 21 | * 22 | * @since Java Persistence 2.0 23 | */ 24 | public enum ValidationMode { 25 | 26 | /** 27 | * If a Bean Validation provider is present in the environment, 28 | * the persistence provider must perform the automatic validation 29 | * of entities. If no Bean Validation provider is present in the 30 | * environment, no lifecycle event validation takes place. 31 | * This is the default behavior. 32 | */ 33 | AUTO, 34 | 35 | /** 36 | * The persistence provider must perform the lifecycle event 37 | * validation. It is an error if there is no Bean Validation 38 | * provider present in the environment. 39 | */ 40 | CALLBACK, 41 | 42 | /** 43 | * The persistence provider must not perform lifecycle event validation. 44 | */ 45 | NONE 46 | } 47 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/Version.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence; 17 | 18 | import java.lang.annotation.Target; 19 | import java.lang.annotation.Retention; 20 | import static java.lang.annotation.ElementType.METHOD; 21 | import static java.lang.annotation.ElementType.FIELD; 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 23 | 24 | /** 25 | * Specifies the version field or property of an entity class that 26 | * serves as its optimistic lock value. The version is used to ensure 27 | * integrity when performing the merge operation and for optimistic 28 | * concurrency control. 29 | * 30 | *
Only a single Version
property or field
31 | * should be used per class; applications that use more than one
32 | * Version
property or field will not be portable.
33 | *
34 | *
The Version
property should be mapped to
35 | * the primary table for the entity class; applications that
36 | * map the Version
property to a table other than
37 | * the primary table will not be portable.
38 | *
39 | *
The following types are supported for version properties:
40 | * int
, Integer
, short
,
41 | * Short
, long
, Long
,
42 | * java.sql.Timestamp
.
43 | *
44 | *
45 | * Example: 46 | * 47 | * @Version 48 | * @Column(name="OPTLOCK") 49 | * protected int getVersionNum() { return versionNum; } 50 | *51 | * 52 | * @since Java Persistence 1.0 53 | */ 54 | @Target({METHOD, FIELD}) 55 | @Retention(RUNTIME) 56 | public @interface Version {} 57 | -------------------------------------------------------------------------------- /javax.persistence-api/src/main/java/javax/persistence/criteria/CollectionJoin.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package javax.persistence.criteria; 17 | 18 | import java.util.Collection; 19 | import javax.persistence.metamodel.CollectionAttribute; 20 | 21 | /** 22 | * The
CollectionJoin
interface is the type of the result of
23 | * joining to a collection over an association or element
24 | * collection that has been specified as a java.util.Collection
.
25 | *
26 | * @param Collection
28 | *
29 | * @since Java Persistence 2.0
30 | */
31 | public interface CollectionJoinCollection
that is
58 | * the target of the join
59 | */
60 | CollectionAttribute super Z, E> getModel();
61 | }
62 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/criteria/CommonAbstractCriteria.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence.criteria;
17 |
18 | /**
19 | * The CommonAbstractCriteria
interface defines functionality
20 | * that is common to both top-level criteria queries and subqueries as
21 | * well as to update and delete criteria operations.
22 | * It is not intended to be used directly in query construction.
23 | *
24 | * Note that criteria queries and criteria update and delete operations
25 | * are typed differently.
26 | * Criteria queries are typed according to the query result type.
27 | * Update and delete operations are typed according to the target of the
28 | * update or delete.
29 | *
30 | * @since Java Persistence 2.1
31 | */
32 | public interface CommonAbstractCriteria {
33 |
34 | /**
35 | * Create a subquery of the query.
36 | * @param type the subquery result type
37 | * @return subquery
38 | */
39 | Subquery subquery(Class type);
40 |
41 | /**
42 | * Return the predicate that corresponds to the where clause
43 | * restriction(s), or null if no restrictions have been
44 | * specified.
45 | * @return where clause predicate
46 | */
47 | Predicate getRestriction();
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/criteria/CompoundSelection.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence.criteria;
17 |
18 | /**
19 | * The Implementations must be thread-safe.
25 | *
26 | * Note that the CompoundSelection
interface defines a compound selection item
20 | * (tuple, array, or result of constructor).
21 | *
22 | * @param RIGHT
join
23 | * types will not be portable.
24 | *
25 | * @since Java Persistence 2.0
26 | */
27 | public enum JoinType {
28 |
29 | /** Inner join. */
30 | INNER,
31 |
32 | /** Left outer join. */
33 | LEFT,
34 |
35 | /** Right outer join. */
36 | RIGHT
37 | }
38 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/criteria/Order.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence.criteria;
17 |
18 | /**
19 | * An object that defines an ordering over the query results.
20 | *
21 | * @since Java Persistence 2.0
22 | */
23 | public interface Order {
24 |
25 | /**
26 | * Switch the ordering.
27 | * @return a new Order
instance with the reversed ordering
28 | */
29 | Order reverse();
30 |
31 | /**
32 | * Whether ascending ordering is in effect.
33 | * @return boolean indicating whether ordering is ascending
34 | */
35 | boolean isAscending();
36 |
37 | /**
38 | * Return the expression that is used for ordering.
39 | * @return expression used for ordering
40 | */
41 | Expression> getExpression();
42 | }
43 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/criteria/ParameterExpression.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence.criteria;
17 |
18 | import javax.persistence.Parameter;
19 |
20 | /**
21 | * Type of criteria query parameter expressions.
22 | *
23 | * @param PluralJoin
interface defines functionality
22 | * that is common to joins to all collection types. It is
23 | * not intended to be used directly in query construction.
24 | *
25 | * @param AND
.
37 | * @return boolean operator for the predicate
38 | */
39 | BooleanOperator getOperator();
40 |
41 | /**
42 | * Whether the predicate has been created from another
43 | * predicate by applying the Predicate.not()
method
44 | * or the CriteriaBuilder.not()
method.
45 | * @return boolean indicating if the predicate is
46 | * a negated predicate
47 | */
48 | boolean isNegated();
49 |
50 | /**
51 | * Return the top-level conjuncts or disjuncts of the predicate.
52 | * Returns empty list if there are no top-level conjuncts or
53 | * disjuncts of the predicate.
54 | * Modifications to the list do not affect the query.
55 | * @return list of boolean expressions forming the predicate
56 | */
57 | ListSelection
interface defines an item that is to be
23 | * returned in a query result.
24 | *
25 | * @param SetJoin
interface is the type of the result of
23 | * joining to a collection over an association or element
24 | * collection that has been specified as a java.util.Set
.
25 | *
26 | * @param Set
28 | *
29 | * @since Java Persistence 2.0
30 | */
31 | public interface SetJoinSet
that is
56 | * the target of the join
57 | */
58 | SetAttribute super Z, E> getModel();
59 | }
60 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/criteria/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 |
17 | /**
18 | * Java Persistence Criteria API
19 | */
20 | package javax.persistence.criteria;
21 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/metamodel/BasicType.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence.metamodel;
17 |
18 | /**
19 | * Instances of the type BasicType
represent basic types (including
20 | * temporal and enumerated types).
21 | *
22 | * @param Bindable
represent object or attribute types
20 | * that can be bound into a {@link javax.persistence.criteria.Path Path}.
21 | *
22 | * @param PLURAL_ATTRIBUTE
,
50 | * the Java element type is returned. If the bindable type is
51 | * SINGULAR_ATTRIBUTE
or ENTITY_TYPE
,
52 | * the Java type of the
53 | * represented entity or attribute is returned.
54 | * @return Java type
55 | */
56 | ClassCollectionAttribute
represent persistent
20 | * java.util.Collection
-valued attributes.
21 | *
22 | * @param EmbeddableType
represent embeddable types.
20 | *
21 | * @param EntityType
represent entity types.
20 | *
21 | * @param ListAttribute
represent persistent
20 | * javax.util.List
-valued attributes.
21 | *
22 | * @param MapAttribute
represent
20 | * persistent java.util.Map
-valued attributes.
21 | *
22 | * @param MappedSuperclassType
represent mapped
20 | * superclass types.
21 | *
22 | * @param PluralAttribute
represent
20 | * persistent collection-valued attributes.
21 | *
22 | * @param SetAttribute
represent
20 | * persistent java.util.Set
-valued attributes.
21 | *
22 | * @param SingularAttribute
represents persistent
20 | * single-valued properties or fields.
21 | *
22 | * @param StaticMetamodel
annotation specifies that the class
25 | * is a metamodel class that represents the entity, mapped
26 | * superclass, or embeddable class designated by the value
27 | * element.
28 | *
29 | * @since Java Persistence 2.0
30 | */
31 | @Target(ElementType.TYPE)
32 | @Retention(RetentionPolicy.RUNTIME)
33 | public @interface StaticMetamodel {
34 |
35 | /**
36 | * Class being modelled by the annotated class.
37 | */
38 | Class> value();
39 | }
40 |
--------------------------------------------------------------------------------
/javax.persistence-api/src/main/java/javax/persistence/metamodel/Type.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
3 | *
4 | * This program and the accompanying materials are made available under the
5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6 | * which accompanies this distribution.
7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8 | * and the Eclipse Distribution License is available at
9 | * http://www.eclipse.org/org/documents/edl-v10.php.
10 | *
11 | * Contributors:
12 | * Linda DeMichiel - Java Persistence 2.1
13 | * Linda DeMichiel - Java Persistence 2.0
14 | *
15 | ******************************************************************************/
16 | package javax.persistence.metamodel;
17 |
18 | /**
19 | * Instances of the type Type
represent persistent object
20 | * or attribute types.
21 | *
22 | * @param getPersistenceProviders
method can potentially
27 | * be called many times: it is recommended that the implementation
28 | * of this method make use of caching.
29 | *
30 | * @see PersistenceProvider
31 | * @since Java Persistence 2.0
32 | */
33 | public interface PersistenceProviderResolver {
34 |
35 | /**
36 | * Returns a list of the PersistenceProvider
implementations
37 | * available in the runtime environment.
38 | *
39 | * @return list of the persistence providers available
40 | * in the environment
41 | */
42 | List