You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2008/11/26 23:29:13 UTC
svn commit: r721006 [1/2] - in
/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence:
./ spi/
Author: djencks
Date: Wed Nov 26 14:29:12 2008
New Revision: 721006
URL: http://svn.apache.org/viewvc?rev=721006&view=rev
Log:
GERONIMO-4410 apply second set of jpa 2 api updates. A couple classes required manual merging
Modified:
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/AssociationOverride.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CascadeType.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CaseExpression.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/DomainObject.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityExistsException.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManager.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManagerFactory.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityNotFoundException.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Expression.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/LockModeType.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NamedQuery.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NoResultException.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NonUniqueResultException.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToMany.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToOne.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PathExpression.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PersistenceException.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Predicate.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PredicateOperand.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/QueryBuilder.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/QueryDefinition.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/SelectItem.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/SequenceGenerator.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/TransactionRequiredException.java
geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/spi/PersistenceUnitInfo.java
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/AssociationOverride.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/AssociationOverride.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/AssociationOverride.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/AssociationOverride.java Wed Nov 26 14:29:12 2008
@@ -32,6 +32,7 @@
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface AssociationOverride {
- String name();
- JoinColumn[] joinColumns();
+ String name();
+ JoinColumn[] joinColumns();
+ JoinTable joinTable() default @JoinTable;
}
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CascadeType.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CascadeType.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CascadeType.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CascadeType.java Wed Nov 26 14:29:12 2008
@@ -28,4 +28,4 @@
* @version $Rev$ $Date$
*/
public enum CascadeType {
- ALL, PERSIST, MERGE, REMOVE, REFRESH};
+ ALL, PERSIST, MERGE, REMOVE, REFRESH, CLEAR};
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CaseExpression.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CaseExpression.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CaseExpression.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/CaseExpression.java Wed Nov 26 14:29:12 2008
@@ -36,7 +36,7 @@
* predicate must be followed by the corresponding then case expression that
* specifies the result of the specific case. Clauses are evaluated in the
* order added.
- *
+ *
* @param pred -
* corresponds to the evaluation condition for the specific case
* @return CaseExpression corresponding to the case with the added when
@@ -48,7 +48,7 @@
* Add a when clause to a simple case expression. The when case expression
* must be followed by the corresponding then case expression that specifies
* the result of the specific case. Clauses are evaluated in the order added
- *
+ *
* @param when -
* corresponds to the value against which the case operand of the
* simple case is tested
@@ -60,7 +60,7 @@
* Add a when clause to a simple case expression. The when case expression
* must be followed by the corresponding then case expression that specifies
* the result of the specific case. Clauses are evaluated in the order added
- *
+ *
* @param when -
* corresponds to the value against which the case operand of the
* simple case is tested
@@ -72,7 +72,7 @@
* Add a when clause to a simple case expression. The when case expression
* must be followed by the corresponding then case expression that specifies
* the result of the specific case. Clauses are evaluated in the order added
- *
+ *
* @param when -
* corresponds to the value against which the
* case operand of the simple case is tested
@@ -84,7 +84,7 @@
* Add a when clause to a simple case expression. The when case expression
* must be followed by the corresponding then case expression that specifies
* the result of the specific case. Clauses are evaluated in the order added
- *
+ *
* @param when -
* corresponds to the value against which the case operand of the
* simple case is tested
@@ -96,7 +96,7 @@
* Add a when clause to a simple case expression. The when case expression
* must be followed by the corresponding then case expression that specifies
* the result of the specific case. Clauses are evaluated in the order added
- *
+ *
* @param when -
* corresponds to the value against which the case operand of the
* simple case is tested
@@ -108,7 +108,7 @@
* Add a when clause to a simple case expression. The when case expression
* must be followed by the corresponding then case expression that specifies
* the result of the specific case. Clauses are evaluated in the order added
- *
+ *
* @param when -
* corresponds to the value against which the case operand of the
* simple case is tested
@@ -120,7 +120,7 @@
* Add a when clause to a simple case expression. The when case expression
* must be followed by the corresponding then case expression that specifies
* the result of the specific case. Clauses are evaluated in the order added
- *
+ *
* @param when -
* corresponds to the value against which the case operand of the
* simple case is tested
@@ -132,7 +132,7 @@
* Add a then clause to a general or simple case expression. The then clause
* specifies the result corresponding to the immediately preceding when.
* Clauses are evaluated in the order added.
- *
+ *
* @param then -
* corresponds to the result of the case expression if the when
* is satisfied
@@ -145,7 +145,7 @@
* Add a then clause to a general or simple case expression. The then clause
* specifies the result corresponding to the immediately preceding when.
* Clauses are evaluated in the order added.
- *
+ *
* @param then -
* corresponds to the result of the case expression if the when
* is satisfied
@@ -158,7 +158,7 @@
* Add a then clause to a general or simple case expression. The then clause
* specifies the result corresponding to the immediately preceding when.
* Clauses are evaluated in the order added.
- *
+ *
* @param then -
* corresponds to the result of the case expression if the when
* is satisfied
@@ -171,7 +171,7 @@
* Add a then clause to a general or simple case expression. The then clause
* specifies the result corresponding to the immediately preceding when.
* Clauses are evaluated in the order added.
- *
+ *
* @param then -
* corresponds to the result of the case expression if the when
* is satisfied
@@ -184,7 +184,7 @@
* Add a then clause to a general or simple case expression. The then clause
* specifies the result corresponding to the immediately preceding when.
* Clauses are evaluated in the order added.
- *
+ *
* @param then -
* corresponds to the result of the case expression if the when
* is satisfied
@@ -197,7 +197,7 @@
* Add a then clause to a general or simple case expression. The then clause
* specifies the result corresponding to the immediately preceding when.
* Clauses are evaluated in the order added.
- *
+ *
* @param then -
* corresponds to the result of the case expression if the when
* is satisfied
@@ -210,7 +210,7 @@
* Add a then clause to a general or simple case expression. The then clause
* specifies the result corresponding to the immediately preceding when.
* Clauses are evaluated in the order added.
- *
+ *
* @param then -
* corresponds to the result of the case expression if the when
* is satisfied
@@ -222,7 +222,7 @@
/**
* Add else to a case expression. A case expression must have an else
* clause.
- *
+ *
* @param arg -
* corresponds to the result of the case expression if the when
* condition is not satisfied
@@ -234,7 +234,7 @@
/**
* Add else to a case expression. A case expression must have an else
* clause.
- *
+ *
* @param arg -
* corresponds to the result of the case expression if the when
* condition is not satisfied
@@ -246,7 +246,7 @@
/**
* Add else to a case expression. A case expression must have an else
* clause.
- *
+ *
* @param arg -
* corresponds to the result of the case expression if the when
* condition is not satisfied
@@ -258,7 +258,7 @@
/**
* Add else to a case expression. A case expression must have an else
* clause.
- *
+ *
* @param arg -
* corresponds to the result of the case expression if the when
* condition is not satisfied
@@ -270,7 +270,7 @@
/**
* Add else to a case expression. A case expression must have an else
* clause.
- *
+ *
* @param arg -
* corresponds to the result of the case expression if the when
* condition is not satisfied
@@ -282,7 +282,7 @@
/**
* Add else to a case expression. A case expression must have an else
* clause.
- *
+ *
* @param arg -
* corresponds to the result of the case expression if the when
* condition is not satisfied
@@ -294,7 +294,7 @@
/**
* Add else to a case expression. A case expression must have an else
* clause.
- *
+ *
* @param arg -
* corresponds to the result of the case expression if the when
* condition is not satisfied
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/DomainObject.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/DomainObject.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/DomainObject.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/DomainObject.java Wed Nov 26 14:29:12 2008
@@ -39,7 +39,7 @@
* object must correspond to a class that contains the referenced attribute.
* The query definition is modified to include the newly joined domain
* object.
- *
+ *
* @param attribute -
* name of the attribute that references the target of the join
* @return the new DomainObject that is added for the target of the join
@@ -55,7 +55,7 @@
* operations. The domain object must correspond to a class that contains
* the referenced attribute. The query definition is modified to include the
* newly joined domain object.
- *
+ *
* @param attribute -
* name of the attribute that references the target of the join
* @return the new DomainObject that is added for the target of the join
@@ -67,7 +67,7 @@
* the attribute be eagerly fetched through use of an inner join. The domain
* object must correspond to a class that contains the referenced attribute.
* The query is modified to include the joined domain object.
- *
+ *
* @param attribute -
* name of the attribute that references the target of the join
* @return the FetchJoinObject that is added for the target of the join
@@ -79,7 +79,7 @@
* the attribute be eagerly fetched through use of a left outer join. The
* domain object must correspond to a class that contains the referenced
* attribute. The query is modified to include the joined domain object.
- *
+ *
* @param attribute -
* name of the attribute that references the target of the join
* @return the FetchJoinObject that is added for the target of the join
@@ -91,7 +91,7 @@
* association or element collection. This method is only permitted to be
* invoked upon a domain object that corresponds to a map-valued association
* or element collection.
- *
+ *
* @return PathExpression corresponding to the map value
*/
PathExpression value();
@@ -101,7 +101,7 @@
* association or element collection. This method is only permitted to be
* invoked upon a domain object that corresponds to a map-valued association
* or element collection.
- *
+ *
* @return PathExpression corresponding to the map key
*/
PathExpression key();
@@ -111,7 +111,7 @@
* association or element collection. This method is only permitted to be
* invoked upon a domain object that corresponds to a map-valued association
* or element collection.
- *
+ *
* @return SelectItem corresponding to the map entry
*/
SelectItem entry();
@@ -122,7 +122,7 @@
* permitted to be invoked upon a domain object that corresponds to a
* multi-valued association or element collection for which an order column
* has been defined.
- *
+ *
* @return Expression denoting the index
*/
Expression index();
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityExistsException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityExistsException.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityExistsException.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityExistsException.java Wed Nov 26 14:29:12 2008
@@ -30,7 +30,7 @@
public class EntityExistsException extends PersistenceException {
public EntityExistsException() {
-
+
}
public EntityExistsException(String message) {
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManager.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManager.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManager.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManager.java Wed Nov 26 14:29:12 2008
@@ -24,52 +24,532 @@
//
package javax.persistence;
-/**
+import java.util.Map;
+import java.util.Set;
+
+ /**
+ * Interface used to interact with the persistence context.
* @version $Rev$ $Date$
*/
public interface EntityManager {
- public void persist(Object entity);
-
- public <T> T merge(T entity);
-
- public void remove(Object entity);
-
- public <T> T find(Class<T> entityClass, Object primaryKey);
-
- public <T> T getReference(Class<T> entityClass, Object primaryKey);
-
- public void flush();
-
- public void setFlushMode(FlushModeType flushMode);
-
- public FlushModeType getFlushMode();
-
+ /**
+ * Make an instance managed and persistent.
+ * @param entity
+ * @throws EntityExistsException if the entity already exists.
+ * (The EntityExistsException may be thrown when the persist
+ * operation is invoked, or the EntityExistsException or
+ * another PersistenceException may be thrown at flush or
+ * commit time.)
+ * @throws IllegalArgumentException if the instance is not an
+ * entity
+ * @throws TransactionRequiredException if invoked on a
+ * container-managed entity manager of type
+ * PersistenceContextType.TRANSACTION and there is
+ * no transaction.
+ */
+ public void persist(Object entity);
+ /**
+ * Merge the state of the given entity into the
+ * current persistence context.
+ * @param entity
+ * @return the managed instance that the state was merged to
+ * @throws IllegalArgumentException if instance is not an
+ * entity or is a removed entity
+ * @throws TransactionRequiredException if invoked on a
+ * container-managed entity manager of type
+ * PersistenceContextType.TRANSACTION and there is
+ * no transaction.
+ */
+ public <T> T merge(T entity);
+ /**
+ * Remove the entity instance.
+ * @param entity
+ * @throws IllegalArgumentException if the instance is not an
+ * entity or is a detached entity
+ * @throws TransactionRequiredException if invoked on a
+ * container-managed entity manager of type
+ * PersistenceContextType.TRANSACTION and there is
+ * no transaction.
+ */
+ public void remove(Object entity);
+ /**
+ * Find by primary key.
+ * Search for an entity of the specified class and primary key.
+ * If the entity instance is contained in the persistence context
+ * it is returned from there.
+ * @param entityClass
+ * @param primaryKey
+ * @return the found entity instance or null
+ * if the entity does not exist
+ * @throws IllegalArgumentException if the first argument does
+ * not denote an entity type or the second argument is
+ * is not a valid type for that entitys primary key or
+ * is null
+ */
+ public <T> T find(Class<T> entityClass, Object primaryKey);
+ /**
+ * Find by primary key and lock.
+ * Search for an entity of the specified class and primary key
+ * and lock it with respect to the specified lock type.
+ * If the entity instance is contained in the persistence context
+ * it is returned from there, and the effect of this method is
+ * the same as if the lock method had been called on the entity.
+ * If the entity is found within the persistence context and the
+ * lock mode type is pessimistic and the entity has a version
+ * attribute, the persistence provider must perform optimistic
+ * version checks when obtaining the database lock. If these
+ * checks fail, the OptimisticLockException will be thrown.
+ * If the lock mode type is pessimistic and the entity instance
+ * is found but cannot be locked:
+ * - the PessimisticLockException will be thrown if the database
+ * locking failure causes transaction-level rollback.
+ * - the LockTimeoutException will be thrown if the database
+ * locking failure causes only statement-level rollback
+ * @param entityClass
+ * @param primaryKey
+ * @param lockMode
+ * @return the found entity instance or null if the entity does
+ * not exist
+ * @throws IllegalArgumentException if the first argument does
+ * not denote an entity type or the second argument is
+ * not a valid type for that entity's primary key or
+ * is null
+ * @throws TransactionRequiredException if there is no
+ * transaction and a lock mode other than NONE is set
+ * @throws OptimisticLockException if the optimistic version
+ * check fails
+ * @throws PessimisticLockException if pessimistic locking
+ * fails and the transaction is rolled back
+ * @throws LockTimeoutException if pessimistic locking fails and
+ * only the statement is rolled back
+ * @throws PersistenceException if an unsupported lock call
+ * is made
+ */
+ public <T> T find(Class<T> entityClass, Object primaryKey,
+ LockModeType lockMode);
+ /**
+ * Find by primary key and lock, using specified properties.
+ * Search for an entity of the specified class and primary key
+ * and lock it with respect to the specified lock type.
+ * If the entity instance is contained in the persistence context
+ * it is returned from there. If the entity is found
+ * within the persistence context and the lock mode type
+ * is pessimistic and the entity has a version attribute, the
+ * persistence provider must perform optimistic version checks
+ * when obtaining the database lock. If these checks fail,
+ * the OptimisticLockException will be thrown.
+ * If the lock mode type is pessimistic and the entity instance
+ * is found but cannot be locked:
+ * - the PessimisticLockException will be thrown if the database
+ * locking failure causes transaction-level rollback.
+ * - the LockTimeoutException will be thrown if the database
+ * locking failure causes only statement-level rollback
+ * If a vendor-specific property or hint is not recognized,
+ * it is silently ignored.
+ * Portable applications should not rely on the standard timeout
+ * hint. Depending on the database in use and the locking
+ * mechanisms used by the provider, the hint may or may not
+ * be observed.
+ * @param entityClass
+ * @param primaryKey
+ * @param lockMode
+ * @param properties standard and vendor-specific properties
+ * and hints
+ * @return the found entity instance or null if the entity does
+ * not exist
+ * @throws IllegalArgumentException if the first argument does
+ * not denote an entity type or the second argument is
+ * not a valid type for that entity's primary key or
+ * is null
+ * @throws TransactionRequiredException if there is no
+ * transaction and a lock mode other than NONE is set
+ * @throws OptimisticLockException if the optimistic version
+ * check fails
+ * @throws PessimisticLockException if pessimistic locking
+ * fails and the transaction is rolled back
+ * @throws LockTimeoutException if pessimistic locking fails and
+ * only the statement is rolled back
+ * @throws PersistenceException if an unsupported lock call
+ * is made
+ */
+ public <T> T find(Class<T> entityClass, Object primaryKey,
+ LockModeType lockMode,
+ Map<String, Object> properties);
+ /**
+ * Get an instance, whose state may be lazily fetched.
+ * If the requested instance does not exist in the database,
+ * the EntityNotFoundException is thrown when the instance
+ * state is first accessed. (The persistence provider runtime is
+ * permitted to throw the EntityNotFoundException when
+ * getReference is called.)
+ * The application should not expect that the instance state will
+ * be available upon detachment, unless it was accessed by the
+ * application while the entity manager was open.
+ * @param entityClass
+ * @param primaryKey
+ * @return the found entity instance
+ * @throws IllegalArgumentException if the first argument does
+ * not denote an entity type or the second argument is
+ * not a valid type for that entitys primary key or
+ * is null
+ * @throws EntityNotFoundException if the entity state
+ * cannot be accessed
+ */
+ public <T> T getReference(Class<T> entityClass, Object primaryKey);
+ /**
+ * Synchronize the persistence context to the
+ * underlying database.
+ * @throws TransactionRequiredException if there is
+ * no transaction
+ * @throws PersistenceException if the flush fails
+ */
+ public void flush();
+ /**
+ * Set the flush mode that applies to all objects contained
+ * in the persistence context.
+ * @param flushMode
+ */
+ public void setFlushMode(FlushModeType flushMode);
+ /**
+ * Get the flush mode that applies to all objects contained
+ * in the persistence context.
+ * @return flushMode
+ */
+ public FlushModeType getFlushMode();
+ /**
+ * Lock an entity instance that is contained in the persistence
+ * context with the specified lock mode type.
+ * If a pessimistic lock mode type is specified and the entity
+ * contains a version attribute, the persistence provider must
+ * also perform optimistic version checks when obtaining the
+ * database lock. If these checks fail, the
+ * OptimisticLockException will be thrown.
+ * If the lock mode type is pessimistic and the entity instance
+ * is found but cannot be locked:
+ * - the PessimisticLockException will be thrown if the database
+ * locking failure causes transaction-level rollback.
+ * - the LockTimeoutException will be thrown if the database
+ * locking failure causes only statement-level rollback
+ * @param entity
+ * @param lockMode
+ * @throws IllegalArgumentException if the instance is not an
+ * entity or is a detached entity
+ * @throws TransactionRequiredException if there is no
+ * transaction
+ * @throws EntityNotFoundException if the entity does not exist
+ * in the database when pessimistic locking is
+ * performed
+ * @throws OptimisticLockException if the optimistic version
+ * check fails
+ * @throws PessimisticLockException if pessimistic locking fails
+ * and the transaction is rolled back
+ * @throws LockTimeoutException if pessimistic locking fails and
+ * only the statement is rolled back
+ * @throws PersistenceException if an unsupported lock call
+ * is made
+ */
public void lock(Object entity, LockModeType lockMode);
-
- public void refresh(Object entity);
-
- public void clear();
-
- public boolean contains(Object entity);
-
- public Query createQuery(String ejbqlString);
-
- public Query createNamedQuery(String name);
-
- public Query createNativeQuery(String sqlString);
-
- public Query createNativeQuery(String sqlString, Class resultClass);
-
- public Query createNativeQuery(String sqlString, String resultSetMapping);
-
- public void close();
-
- public boolean isOpen();
-
- public EntityTransaction getTransaction();
-
- public void joinTransaction();
-
- public Object getDelegate();
+ /**
+ * Lock an entity instance that is contained in the persistence
+ * context with the specified lock mode type and with specified
+ * properties.
+ * If a pessimistic lock mode type is specified and the entity
+ * contains a version attribute, the persistence provider must
+ * also perform optimistic version checks when obtaining the
+ * database lock. If these checks fail, the
+ * OptimisticLockException will be thrown.
+ * If the lock mode type is pessimistic and the entity instance
+ * is found but cannot be locked:
+ * - the PessimisticLockException will be thrown if the database
+ * locking failure causes transaction-level rollback.
+ * - the LockTimeoutException will be thrown if the database
+ * locking failure causes only statement-level rollback
+ * If a vendor-specific property or hint is not recognized,
+ * it is silently ignored.
+ * Portable applications should not rely on the standard timeout
+ * hint. Depending on the database in use and the locking
+ * mechanisms used by the provider, the hint may or may not
+ * be observed.
+ * @param entity
+ * @param lockMode
+ * @param properties standard and vendor-specific properties
+ * and hints
+ * @throws IllegalArgumentException if the instance is not an
+ * entity or is a detached entity
+ * @throws TransactionRequiredException if there is no
+ * transaction
+ * @throws EntityNotFoundException if the entity does not exist
+ * in the database when pessimistic locking is
+ * performed
+ * @throws OptimisticLockException if the optimistic version
+ * check fails
+ * @throws PessimisticLockException if pessimistic locking fails
+ * and the transaction is rolled back
+ * @throws LockTimeoutException if pessimistic locking fails and
+ * only the statement is rolled back
+ * @throws PersistenceException if an unsupported lock call
+ * is made
+ */
+ public void lock(Object entity, LockModeType lockMode,
+ Map<String, Object> properties);
+ /**
+ * Refresh the state of the instance from the database,
+ * overwriting changes made to the entity, if any.
+ * @param entity
+ * @throws IllegalArgumentException if the instance is not
+ * an entity or the entity is not managed
+ * @throws TransactionRequiredException if invoked on a
+ * container-managed entity manager of type
+ * PersistenceContextType.TRANSACTION and there is
+ * no transaction.
+ * @throws EntityNotFoundException if the entity no longer
+ * exists in the database
+ */
+ public void refresh(Object entity);
+ /**
+ * Refresh the state of the instance from the database,
+ * overwriting changes made to the entity, if any, and
+ * lock it with respect to given lock mode type.
+ * If the lock mode type is pessimistic and the entity instance
+ * is found but cannot be locked:
+ * - the PessimisticLockException will be thrown if the database
+ * locking failure causes transaction-level rollback.
+ * - the LockTimeoutException will be thrown if the
+ * database locking failure causes only statement-level
+ * rollback.
+ * @param entity
+ * @param lockMode
+ * @throws IllegalArgumentException if the instance is not
+ * an entity or the entity is not managed
+ * @throws TransactionRequiredException if there is no
+ * transaction
+ * @throws EntityNotFoundException if the entity no longer exists
+ * in the database
+ * @throws PessimisticLockException if pessimistic locking fails
+ * and the transaction is rolled back
+ * @throws LockTimeoutException if pessimistic locking fails and
+ * only the statement is rolled back
+ * @throws PersistenceException if an unsupported lock call
+ * is made
+ */
+ public void refresh(Object entity, LockModeType lockMode);
+ /**
+ * Refresh the state of the instance from the database,
+ * overwriting changes made to the entity, if any, and
+ * lock it with respect to given lock mode type and with
+ * specified properties.
+ * If the lock mode type is pessimistic and the entity instance
+ * is found but cannot be locked:
+ * - the PessimisticLockException will be thrown if the database
+ * locking failure causes transaction-level rollback.
+ * - the LockTimeoutException will be thrown if the database
+ * locking failure causes only statement-level rollback
+ * If a vendor-specific property or hint is not recognized,
+ * it is silently ignored.
+ * Portable applications should not rely on the standard timeout
+ * hint. Depending on the database in use and the locking
+ * mechanisms used by the provider, the hint may or may not
+ * be observed.
+ * @param entity
+ * @param lockMode
+ * @param properties standard and vendor-specific properties
+ * and hints
+ * @throws IllegalArgumentException if the instance is not
+ * an entity or the entity is not managed
+ * @throws TransactionRequiredException if there is no
+ * transaction
+ * @throws EntityNotFoundException if the entity no longer exists
+ * in the database
+ * @throws PessimisticLockException if pessimistic locking fails
+ * and the transaction is rolled back
+ * @throws LockTimeoutException if pessimistic locking fails and
+ * only the statement is rolled back
+ * @throws PersistenceException if an unsupported lock call
+ * is made
+ */
+ public void refresh(Object entity, LockModeType lockMode,
+ Map<String, Object> properties);
+ /**
+ * Clear the persistence context, causing all managed
+ * entities to become detached. Changes made to entities that
+ * have not been flushed to the database will not be
+ * persisted.
+ */
+ public void clear();
+ /**
+ * Remove the given entity from the persistence context, causing
+ * a managed entity to become detached. Unflushed changes made
+ * to the entity if any (including removal of the entity),
+ * will not be synchronized to the database.
+ * @param entity
+ * @throws IllegalArgumentException if the instance is not an
+ * entity
+ */
+ public void clear(Object entity);
+// Open Issue: Alternative names for this method and the corresponding cascade option.
+ /**
+ * Check if the instance is a managed entity instance belonging
+ * to the current persistence context.
+ * @param entity
+ * @return
+ * @throws IllegalArgumentException if not an entity
+ */
+ public boolean contains(Object entity);
+ /**
+ * Get the current lock mode for the entity instance.
+ * @param entity
+ * @return lock mode
+ * @throws TransactionRequiredException if there is no
+ * transaction
+ * @throws IllegalArgumentException if the instance is not a
+ * managed entity and a transaction is active
+ */
+ public LockModeType getLockMode(Object entity);
+ /**
+ * Get the properties and associated values that are in effect
+ * for the entity manager. Changing the contents of the map does
+ * not change the configuration in effect.
+ */
+ public Map<String, Object> getProperties();
+ /**
+ * Get the names of the properties that are supported for use
+ * with the entity manager.
+ * These correspond to properties and hints that may be passed
+ * to the methods of the EntityManager interface that take a
+ * properties argument or used with the PersistenceContext
+ * annotation. These properties include all standard entity
+ * manager hints and properties as well as vendor-specific ones
+ * supported by the provider. These properties may or may not
+ * currently be in effect.
+ * @return property names
+ */
+ public Set<String> getSupportedProperties();
+ /**
+ * Create an instance of Query for executing a
+ * Java Persistence query language statement.
+ * @param qlString a Java Persistence query string
+ * @return the new query instance
+ * @throws IllegalArgumentException if the query string is found
+ * to be invalid
+ */
+ public Query createQuery(String qlString);
+ /**
+ * Create an instance of Query for executing a
+ * criteria query.
+ * @param qdef a Criteria API query definition object
+ * @return the new query instance
+ * @throws IllegalArgumentException if the query definition is
+ * found to be invalid
+ */
+ public Query createQuery(QueryDefinition qdef);
+ /**
+ * Create an instance of Query for executing a
+ * named query (in the Java Persistence query language
+ * or in native SQL).
+ * @param name the name of a query defined in metadata
+ * @return the new query instance
+ * @throws IllegalArgumentException if a query has not been
+ * defined with the given name or if the query string is
+ *found to be invalid
+ */
+ public Query createNamedQuery(String name);
+ /**
+ * Create an instance of Query for executing
+ * a native SQL statement, e.g., for update or delete.
+ * @param sqlString a native SQL query string
+ * @return the new query instance
+ */
+ public Query createNativeQuery(String sqlString);
+ /**
+ * Create an instance of Query for executing
+ * a native SQL query.
+ * @param sqlString a native SQL query string
+ * @param resultClass the class of the resulting instance(s)
+ * @return the new query instance
+ */
+ public Query createNativeQuery(String sqlString,
+ Class resultClass);
+ /**
+ * Create an instance of Query for executing
+ * a native SQL query.
+ * @param sqlString a native SQL query string
+ * @param resultSetMapping the name of the result set mapping
+ * @return the new query instance
+ */
+ public Query createNativeQuery(String sqlString,
+ String resultSetMapping);
+ /**
+ * Indicate to the EntityManager that a JTA transaction is
+ * active. This method should be called on a JTA application
+ * managed EntityManager that was created outside the scope
+ * of the active transaction to associate it with the current
+ * JTA transaction.
+ * @throws TransactionRequiredException if there is
+ * no transaction.
+ */
+ public void joinTransaction();
+ /**
+ * Return an object of the specified type to allow access to the
+ * provider-specific API. If the provider's EntityManager
+ * implementation does not support the specified class, the
+ * PersistenceException is thrown.
+ * @param cls the class of the object to be returned. This is
+ * normally either the underlying EntityManager implementation
+ * class or an interface that it implements.
+ * @return an instance of the specified class
+ * @throws PersistenceException if the provider does not
+ * support the call.
+ */
+ public <T> T unwrap(Class<T> cls);
+ /**
+ * Return the underlying provider object for the EntityManager,
+ * if available. The result of this method is implementation
+ * specific. The unwrap method is to be preferred for new
+ * applications.
+ */
+ public Object getDelegate();
+ /**
+ * Close an application-managed EntityManager.
+ * After the close method has been invoked, all methods
+ * on the EntityManager instance and any Query objects obtained
+ * from it will throw the IllegalStateException except
+ * for getProperties, getSupportedProperties, getTransaction,
+ * and isOpen (which will return false).
+ * If this method is called when the EntityManager is
+ * associated with an active transaction, the persistence
+ * context remains managed until the transaction completes.
+ * @throws IllegalStateException if the EntityManager
+ * is container-managed.
+ */
+ public void close();
+ /**
+ * Determine whether the EntityManager is open.
+ * @return true until the EntityManager has been closed.
+ */
+ public boolean isOpen();
+ /**
+ * Return the resource-level transaction object.
+ * The EntityTransaction instance may be used serially to
+ * begin and commit multiple transactions.
+ * @return EntityTransaction instance
+ * @throws IllegalStateException if invoked on a JTA
+ * EntityManager.
+ */
+ public EntityTransaction getTransaction();
+ /**
+ * Return the entity manager factory for the entity manager.
+ * @return EntityManagerFactory instance
+ * @throws IllegalStateException if the entity manager has
+ * been closed.
+ */
+ public EntityManagerFactory getEntityManagerFactory();
+ /**
+ * Return an instance of QueryBuilder for the creation of
+ * Criteria API QueryDefinition objects.
+ * @return QueryBuilder instance
+ * @throws IllegalStateException if the entity manager has
+ * been closed.
+ */
+ public QueryBuilder getQueryBuilder();
}
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManagerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManagerFactory.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManagerFactory.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityManagerFactory.java Wed Nov 26 14:29:12 2008
@@ -32,7 +32,7 @@
public interface EntityManagerFactory {
EntityManager createEntityManager();
-
+
EntityManager createEntityManager(Map map);
void close();
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityNotFoundException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityNotFoundException.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityNotFoundException.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/EntityNotFoundException.java Wed Nov 26 14:29:12 2008
@@ -31,7 +31,7 @@
public class EntityNotFoundException extends PersistenceException {
/**
- *
+ *
*/
private static final long serialVersionUID = 737197424871374104L;
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Expression.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Expression.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Expression.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Expression.java Wed Nov 26 14:29:12 2008
@@ -37,7 +37,7 @@
* association or element collection denoted by the path expression. The
* argument must correspond to a collection-valued association or element
* collection of like type.
- *
+ *
* @param arg -
* a path expression that specifies a collection-valued
* association or an element collection
@@ -48,7 +48,7 @@
/**
* Create a predicate for testing whether the value of the expression is
* null.
- *
+ *
* @return conditional predicate
*/
Predicate isNull();
@@ -56,7 +56,7 @@
/**
* Create a predicate for testing whether the expression value is a member
* of the argument list.
- *
+ *
* @param strings
* @return conditional predicate
*/
@@ -65,7 +65,7 @@
/**
* Create a predicate for testing whether the expression value is a member
* of the argument list.
- *
+ *
* @param nums
* @return conditional predicate
*/
@@ -74,7 +74,7 @@
/**
* Create a predicate for testing whether the expression value is a member
* of the argument list.
- *
+ *
* @param enums
* @return conditional predicate
*/
@@ -83,7 +83,7 @@
/**
* Create a predicate for testing whether the expression value is a member
* of the argument list.
- *
+ *
* @param classes
* @return conditional predicate
*/
@@ -92,7 +92,7 @@
/**
* Create a predicate for testing whether the expression value is a member
* of the argument list.
- *
+ *
* @param params
* @return conditional predicate
*/
@@ -101,7 +101,7 @@
/**
* Create a predicate for testing whether the expression value is a member
* of a subquery result.
- *
+ *
* @param subquery
* @return conditional predicate
*/
@@ -113,7 +113,7 @@
/**
* String length This method must be invoked on an expression corresponding
* to a string.
- *
+ *
* @return expression denoting the length of the string.
*/
Expression length();
@@ -121,7 +121,7 @@
/**
* Concatenate a string with other string(s). This method must be invoked on
* an expression corresponding to a string.
- *
+ *
* @param str -
* string(s)
* @return expression denoting the concatenation of the strings, starting
@@ -133,7 +133,7 @@
/**
* Concatenate a string with other string(s). This method must be invoked on
* an expression corresponding to a string.
- *
+ *
* @param str -
* expression(s) corresponding to string(s)
* @return expression denoting the concatenation of the strings, starting
@@ -146,7 +146,7 @@
* Extract a substring starting at specified position through to the end of
* the string. This method must be invoked on an expression corresponding to
* a string.
- *
+ *
* @param start -
* start position (1 indicates first position)
* @return expression denoting the extracted substring
@@ -157,7 +157,7 @@
* Extract a substring starting at specified position through to the end of
* the string. This method must be invoked on an expression corresponding to
* a string.
- *
+ *
* @param start -
* expression denoting start position (1 indicates first
* position)
@@ -168,7 +168,7 @@
/**
* Extract a substring. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @param start -
* start position (1 indicates first position)
* @param len -
@@ -180,7 +180,7 @@
/**
* Extract a substring. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @param start -
* start position (1 indicates first position)
* @param len -
@@ -192,7 +192,7 @@
/**
* Extract a substring. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @param start -
* expression denoting start position (1 indicates first
* position)
@@ -205,7 +205,7 @@
/**
* Extract a substring. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @param start -
* expression denoting start position (1 indicates first
* position)
@@ -218,7 +218,7 @@
/**
* Convert string to lowercase. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @return expression denoting the string in lowercase
*/
Expression lower();
@@ -226,7 +226,7 @@
/**
* Convert string to uppercase. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @return expression denoting the string in uppercase
*/
Expression upper();
@@ -234,7 +234,7 @@
/**
* Trim leading and trailing blanks. This method must be invoked on an
* expression corresponding to a string.
- *
+ *
* @return expression denoting trimmed string
*/
Expression trim();
@@ -242,7 +242,7 @@
/**
* Trim leading, trailing blanks (or both) as specified by trim spec. This
* method must be invoked on an expression corresponding to a string.
- *
+ *
* @param spec -
* trim specification
* @return expression denoting trimmed string
@@ -252,7 +252,7 @@
/**
* Trim leading and trailing occurrences of character from the string. This
* method must be invoked on an expression corresponding to a string.
- *
+ *
* @param c -
* character to be trimmed
* @return expression denoting trimmed string
@@ -263,7 +263,7 @@
* Trim occurrences of the character from leading or trailing (or both)
* positions of the string, as specified by trim spec. This method must be
* invoked on an expression corresponding to a string.
- *
+ *
* @param c -
* character to be trimmed
* @param spec -
@@ -276,7 +276,7 @@
* Trim leading and trailing occurrences of character specified by the
* expression argument from the string. This method must be invoked on an
* expression corresponding to a string.
- *
+ *
* @param expr -
* expression corresponding to the character to be trimmed
* @return expression denoting trimmed string
@@ -288,7 +288,7 @@
* from leading or trailing (or both) positions of the string, as specified
* by trim spec. This method must be invoked on an expression corresponding
* to a string.
- *
+ *
* @param expr -
* expression corresponding to the character to be trimmed
* @param spec -
@@ -302,7 +302,7 @@
* expression on which the method was invoked. The search is started at
* position 1 (first string position). This method must be invoked on an
* expression corresponding to a string.
- *
+ *
* @param str -
* string to be located
* @return expression denoting the first position at which the string was
@@ -315,7 +315,7 @@
* expression on which the method was invoked. The search is started at
* position 1 (first string position). This method must be invoked on an
* expression corresponding to a string.
- *
+ *
* @param str -
* expression corresponding to the string to be located
* @return expression denoting the first position at which the string was
@@ -328,7 +328,7 @@
* expression on which the method was invoked, starting at a specified
* search position. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @param str -
* string to be located
* @param position -
@@ -343,7 +343,7 @@
* expression on which the method was invoked, starting at a specified
* search position. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @param str -
* string to be located
* @param position -
@@ -359,7 +359,7 @@
* expression on which the method was invoked, starting at a specified
* search position. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @param str -
* expression corresponding to the string to be located
* @param position -
@@ -374,7 +374,7 @@
* expression on which the method was invoked, starting at a specified
* search position. This method must be invoked on an expression
* corresponding to a string.
- *
+ *
* @param str -
* expression corresponding to the string to be located
* @param position -
@@ -391,7 +391,7 @@
/**
* Addition. This method must be invoked on an expression corresponding to a
* number.
- *
+ *
* @param num -
* number to be added
* @return expression denoting the sum
@@ -401,7 +401,7 @@
/**
* Addition. This method must be invoked on an expression corresponding to a
* number.
- *
+ *
* @param expr -
* expression corresponding to number to be added
* @return expression denoting the sum
@@ -411,7 +411,7 @@
/**
* Unary minus. This method must be invoked on an expression corresponding
* to a number.
- *
+ *
* @return expression denoting the unary minus of the expression
*/
Expression minus();
@@ -419,7 +419,7 @@
/**
* Subtraction. This method must be invoked on an expression corresponding
* to a number.
- *
+ *
* @param num -
* subtrahend
* @return expression denoting the result of subtracting the argument from
@@ -431,7 +431,7 @@
/**
* Subtraction. This method must be invoked on an expression corresponding
* to a number.
- *
+ *
* @param expr -
* expression corresponding to subtrahend
* @return expression denoting the result of subtracting the number denoted
@@ -443,7 +443,7 @@
/**
* Division. This method must be invoked on an expression corresponding to a
* number.
- *
+ *
* @param num -
* divisor
* @return expression denoting the result of dividing the number
@@ -455,7 +455,7 @@
/**
* Division. This method must be invoked on an expression corresponding to a
* number.
- *
+ *
* @param expr -
* expression corresponding to the divisor
* @return expression denoting the result of dividing the number
@@ -467,7 +467,7 @@
/**
* Multiplication. This method must be invoked on an expression
* corresponding to a number.
- *
+ *
* @param num -
* multiplier
* @return expression denoting the result of multiplying the argument with
@@ -479,7 +479,7 @@
/**
* Multiplication. This method must be invoked on an expression
* corresponding to a number.
- *
+ *
* @param expr -
* expression corresponding to the multiplier
* @return expression denoting the result of multiplying the number denoted
@@ -491,7 +491,7 @@
/**
* Absolute value. This method must be invoked on an expression
* corresponding to a number.
- *
+ *
* @return expression corresponding to the absolute value
*/
Expression abs();
@@ -499,7 +499,7 @@
/**
* Square root. This method must be invoked on an expression corresponding
* to a number.
- *
+ *
* @return expression corresponding to the square root
*/
Expression sqrt();
@@ -507,7 +507,7 @@
/**
* Modulo operation. This must be invoked on an expression corresponding to
* an integer value
- *
+ *
* @param num -
* integer divisor
* @return expression corresponding to the integer remainder of the division
@@ -519,7 +519,7 @@
/**
* Modulo operation. This must be invoked on an expression corresponding to
* an integer value
- *
+ *
* @param expr -
* expression corresponding to integer divisor
* @return expression corresponding to the integer remainder of the division
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/LockModeType.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/LockModeType.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/LockModeType.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/LockModeType.java Wed Nov 26 14:29:12 2008
@@ -28,5 +28,11 @@
* @version $Rev$ $Date$
*/
public enum LockModeType {
- READ, WRITE
+ READ,
+ WRITE,
+ OPTIMISTIC,
+ OPTIMISTIC_FORCE_INCREMENT,
+ PESSIMISTIC,
+ PESSIMISTIC_FORCE_INCREMENT,
+ NONE
}
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NamedQuery.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NamedQuery.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NamedQuery.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NamedQuery.java Wed Nov 26 14:29:12 2008
@@ -39,5 +39,7 @@
String query();
+ LockModeType lockMode() default LockModeType.NONE;
+
QueryHint[] hints() default {};
}
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NoResultException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NoResultException.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NoResultException.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NoResultException.java Wed Nov 26 14:29:12 2008
@@ -30,7 +30,7 @@
public class NoResultException extends PersistenceException {
/**
- *
+ *
*/
private static final long serialVersionUID = 4123871304568481301L;
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NonUniqueResultException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NonUniqueResultException.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NonUniqueResultException.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/NonUniqueResultException.java Wed Nov 26 14:29:12 2008
@@ -31,7 +31,7 @@
public class NonUniqueResultException extends PersistenceException {
/**
- *
+ *
*/
private static final long serialVersionUID = 8841586522747620836L;
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToMany.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToMany.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToMany.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToMany.java Wed Nov 26 14:29:12 2008
@@ -42,4 +42,6 @@
FetchType fetch() default FetchType.LAZY;
String mappedBy() default "";
+
+ boolean orphanRemoval() default false;
}
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToOne.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToOne.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToOne.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/OneToOne.java Wed Nov 26 14:29:12 2008
@@ -44,5 +44,7 @@
boolean optional() default true;
String mappedBy() default "";
+
+ boolean orphanRemoval() default false;
}
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PathExpression.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PathExpression.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PathExpression.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PathExpression.java Wed Nov 26 14:29:12 2008
@@ -34,7 +34,7 @@
* to a multi-valued association or element collection. The path expression
* on which this method is invoked must correspond to a class containing the
* referenced attribute.
- *
+ *
* @param attributeName -
* name of the referenced attribute
* @return path expression
@@ -46,7 +46,7 @@
* method can only be invoked on a path expression corresponding to an
* entity. It is not permitted to invoke this method on a path expression
* that corresponds to a multi-valued association.
- *
+ *
* @return expression denoting the entity's type
*/
Expression type();
@@ -56,7 +56,7 @@
* association or element collection corresponding to the path expression.
* This method can only be invoked on a path expression that corresponds to
* a multi-valued association or to an element collection.
- *
+ *
* @return expression denoting the size
*/
Expression size();
@@ -66,7 +66,7 @@
* association or element collection that is empty (has no elements). This
* method can only be invoked on a path expression that corresponds to a
* multi-valued association or to an element collection.
- *
+ *
* @return predicate corresponding to the restriction
*/
Predicate isEmpty();
@@ -76,7 +76,7 @@
* correspond to an attribute of a numeric type. It is not permitted to
* invoke this method on a path expression that corresponds to a
* multi-valued association or element collection.
- *
+ *
* @return the resulting aggregate
*/
Aggregate avg();
@@ -86,7 +86,7 @@
* correspond to an attribute of an orderable type. It is not permitted to
* invoke this method on a path expression that corresponds to a
* multi-valued association or element collection.
- *
+ *
* @return the resulting aggregate
*/
Aggregate max();
@@ -96,7 +96,7 @@
* correspond to an attribute of an orderable type. It is not permitted to
* invoke this method on a path expression that corresponds to a
* multi-valued association or element collection.
- *
+ *
* @return the resulting aggregate
*/
Aggregate min();
@@ -105,7 +105,7 @@
* Specify that the count operation is to be applied. It is not permitted to
* invoke this method on a path expression that corresponds to a
* multi-valued association or element collection.
- *
+ *
* @return the resulting aggregate
*/
Aggregate count();
@@ -115,7 +115,7 @@
* correspond to an attribute of a numeric type. It is not permitted to
* invoke this method on a path expression that corresponds to a
* multi-valued association or element collection.
- *
+ *
* @return the resulting aggregate
*/
Aggregate sum();
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java Wed Nov 26 14:29:12 2008
@@ -159,7 +159,7 @@
try {
providerClass = Class.forName(providerName, true, Thread
.currentThread().getContextClassLoader());
- }
+ }
catch (Exception e) {
throw new PersistenceException(
"Invalid or inaccessible provider class: " + providerName,
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PersistenceException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PersistenceException.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PersistenceException.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PersistenceException.java Wed Nov 26 14:29:12 2008
@@ -28,7 +28,7 @@
* @version $Rev$ $Date$
*/
public class PersistenceException extends RuntimeException {
-
+
private static final long serialVersionUID = -8734504053550505412L;
public PersistenceException() {
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Predicate.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Predicate.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Predicate.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Predicate.java Wed Nov 26 14:29:12 2008
@@ -30,7 +30,7 @@
public interface Predicate {
/**
* Creates an AND of the predicate with the argument.
- *
+ *
* @param predicate -
* A simple or compound predicate
* @return the predicate that is the AND of the original simple or compound
@@ -40,7 +40,7 @@
/**
* Creates an OR of the predicate with the argument.
- *
+ *
* @param predicate -
* A simple or compound predicate
* @return the predicate that is the OR of the original simple or compound
@@ -50,7 +50,7 @@
/**
* Creates a negation of the predicate with the argument.
- *
+ *
* @return the predicate that is the negation of the original simple or
* compound predicate.
*/
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PredicateOperand.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PredicateOperand.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PredicateOperand.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/PredicateOperand.java Wed Nov 26 14:29:12 2008
@@ -35,7 +35,7 @@
public interface PredicateOperand {
/**
* Create a predicate for testing equality with the specified argument.
- *
+ *
* @param arg -
* PredicateOperand instance or parameter
* @return conditional predicate
@@ -44,7 +44,7 @@
/**
* Create a predicate for testing equality with the specified argument.
- *
+ *
* @param cls -
* entity class
* @return conditional predicate
@@ -53,7 +53,7 @@
/**
* Create a predicate for testing equality with the specified argument.
- *
+ *
* @param arg -
* numeric
* @return conditional predicate
@@ -62,7 +62,7 @@
/**
* Create a predicate for testing equality with the specified argument.
- *
+ *
* @param arg -
* string value
* @return conditional predicate
@@ -71,7 +71,7 @@
/**
* Create a predicate for testing equality with the specified argument.
- *
+ *
* @param arg -
* boolean value
* @return conditional predicate
@@ -80,7 +80,7 @@
/**
* Create a predicate for testing equality with the specified argument.
- *
+ *
* @param arg -
* date
* @return conditional predicate
@@ -89,7 +89,7 @@
/**
* Create a predicate for testing equality with the specified argument.
- *
+ *
* @param arg -
* calendar
* @return conditional predicate
@@ -98,7 +98,7 @@
/**
* Create a predicate for testing equality with the specified argument.
- *
+ *
* @param e -
* enum
* @return conditional predicate
@@ -107,7 +107,7 @@
/**
* Create a predicate for testing inequality with the specified argument.
- *
+ *
* @param arg -
* PredicateOperand instance or parameter
* @return conditional predicate
@@ -116,7 +116,7 @@
/**
* Create a predicate for testing inequality with the specified argument.
- *
+ *
* @param cls -
* entity class
* @return conditional predicate
@@ -125,7 +125,7 @@
/**
* Create a predicate for testing inequality with the specified argument.
- *
+ *
* @param arg -
* numberic value
* @return conditional predicate
@@ -134,7 +134,7 @@
/**
* Create a predicate for testing inequality with the specified argument.
- *
+ *
* @param arg -
* string value
* @return conditional predicate
@@ -143,7 +143,7 @@
/**
* Create a predicate for testing inequality with the specified argument.
- *
+ *
* @param arg -
* boolean value
* @return conditional predicate
@@ -152,7 +152,7 @@
/**
* Create a predicate for testing inequality with the specified argument.
- *
+ *
* @param arg -
* date
* @return conditional predicate
@@ -161,7 +161,7 @@
/**
* Create a predicate for testing inequality with the specified argument.
- *
+ *
* @param arg -
* calendar
* @return conditional predicate
@@ -170,7 +170,7 @@
/**
* Create a predicate for testing inequality with the specified argument.
- *
+ *
* @param e -
* enum
* @return conditional predicate
@@ -180,7 +180,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than the argument.
- *
+ *
* @param arg -
* PredicateOperand instance or parameter
* @return conditional predicate
@@ -190,7 +190,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than the argument.
- *
+ *
* @param arg -
* numeric
* @return conditional predicate
@@ -200,7 +200,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than the argument.
- *
+ *
* @param arg -
* string
* @return conditional predicate
@@ -210,7 +210,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than the argument.
- *
+ *
* @param arg -
* date
* @return conditional predicate
@@ -220,7 +220,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than the argument.
- *
+ *
* @param arg -
* calendar
* @return conditional predicate
@@ -230,7 +230,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than or equal to the argument.
- *
+ *
* @param arg -
* PredicateOperand instance or parameter
* @return conditional predicate
@@ -240,7 +240,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than or equal to the argument.
- *
+ *
* @param arg -
* numeric
* @return conditional predicate
@@ -250,7 +250,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than or equal to the argument.
- *
+ *
* @param arg -
* string
* @return conditional predicate
@@ -260,7 +260,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than or equal to the argument.
- *
+ *
* @param arg -
* date
* @return conditional predicate
@@ -270,7 +270,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is greater
* than or equal to the argument.
- *
+ *
* @param arg -
* calendar
* @return conditional predicate
@@ -280,7 +280,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* the argument.
- *
+ *
* @param arg -
* PredicateOperand instance or parameter
* @return conditional predicate
@@ -290,7 +290,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* the argument.
- *
+ *
* @param arg -
* numeric
* @return conditional predicate
@@ -300,7 +300,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* the argument.
- *
+ *
* @param arg -
* string
* @return conditional predicate
@@ -310,7 +310,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* the argument.
- *
+ *
* @param arg -
* date
* @return conditional predicate
@@ -320,7 +320,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* the argument.
- *
+ *
* @param arg -
* calendar
* @return conditional predicate
@@ -330,7 +330,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* or equal to the argument.
- *
+ *
* @param arg -
* PredicateOperand instance or parameter
* @return conditional predicate
@@ -340,7 +340,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* or equal to the argument.
- *
+ *
* @param arg -
* numeric
* @return conditional predicate
@@ -350,7 +350,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* or equal to the argument.
- *
+ *
* @param arg -
* string
* @return conditional predicate
@@ -360,7 +360,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* or equal to the argument.
- *
+ *
* @param arg -
* date
* @return conditional predicate
@@ -370,7 +370,7 @@
/**
* Create a predicate for testing whether the PredicateOperand is less than
* or equal to the argument.
- *
+ *
* @param arg -
* calendar
* @return conditional predicate
@@ -380,7 +380,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* PredicateOperand instance or parameter
* @param arg2 -
@@ -392,7 +392,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* PredicateOperand instance or parameter
* @param arg2 -
@@ -404,7 +404,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* numeric
* @param arg2 -
@@ -416,7 +416,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* numeric
* @param arg2 -
@@ -428,7 +428,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* PredicateOperand instance or parameter
* @param arg2 -
@@ -440,7 +440,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* string
* @param arg2 -
@@ -452,7 +452,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* string
* @param arg2 -
@@ -464,7 +464,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* PredicateOperand instance or parameter
* @param arg2 -
@@ -476,7 +476,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* date
* @param arg2 -
@@ -488,7 +488,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* date
* @param arg2 -
@@ -500,7 +500,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* PredicateOperand instance or parameter
* @param arg2 -
@@ -512,7 +512,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* calendar
* @param arg2 -
@@ -524,7 +524,7 @@
/**
* Create a predicate for testing whether the PredicateOperand lies between
* (inclusive) the two arguments.
- *
+ *
* @param arg1 -
* calendar
* @param arg2 -
@@ -536,7 +536,7 @@
/**
* Create a predicate for testing whether the PredicateOperand satisfies the
* given pattern.
- *
+ *
* @param pattern
* @return conditional predicate
*/
@@ -545,7 +545,7 @@
/**
* Create a predicate for testing whether the PredicateOperand satisfies the
* given pattern.
- *
+ *
* @param pattern
* @param escapeChar
* @return conditional predicate
@@ -555,7 +555,7 @@
/**
* Create a predicate for testing whether the PredicateOperand satisfies the
* given pattern.
- *
+ *
* @param pattern
* @param escapeChar
* @return conditional predicate
@@ -565,7 +565,7 @@
/**
* Create a predicate for testing whether the PredicateOperand satisfies the
* given pattern.
- *
+ *
* @param pattern
* @return conditional predicate
*/
@@ -574,7 +574,7 @@
/**
* Create a predicate for testing whether the PredicateOperand satisfies the
* given pattern.
- *
+ *
* @param pattern
* @param escapeChar
* @return conditional predicate
@@ -584,7 +584,7 @@
/**
* Create a predicate for testing whether the PredicateOperand satisfies the
* given pattern.
- *
+ *
* @param pattern
* @param escapeChar
* @return conditional predicate
Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java?rev=721006&r1=721005&r2=721006&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java Wed Nov 26 14:29:12 2008
@@ -27,35 +27,249 @@
import java.util.Date;
import java.util.Calendar;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
-/**
+ /**
+ * Interface used to control query execution.
* @version $Rev$ $Date$
*/
public interface Query {
+ /**
+ * Execute a SELECT query and return the query results
+ * as a List.
+ * @return a list of the results
+ * @throws IllegalStateException if called for a Java
+ *Persistence query language UPDATE or DELETE statement
+ * @throws QueryTimeoutException if the query execution exceeds
+ the query timeout value set
+ * @throws TransactionRequiredException if a lock mode has
+ * been set and there is no transaction
+ * @throws PessimisticLockException if pessimistic locking
+ * fails and the transaction is rolled back
+ * @throws LockTimeoutException if pessimistic locking
+ * fails and only the statement is rolled back
+ */
public List getResultList();
+ /**
+ * Execute a SELECT query that returns a single result.
+ * @return the result
+ * @throws NoResultException if there is no result
+ * @throws NonUniqueResultException if more than one result
+ * @throws IllegalStateException if called for a Java
+ * Persistence query language UPDATE or DELETE statement
+ * @throws QueryTimeoutException if the query execution exceeds
+ the query timeout value set
+ * @throws TransactionRequiredException if a lock mode has
+ * been set and there is no transaction
+ * @throws PessimisticLockException if pessimistic locking
+ * fails and the transaction is rolled back
+ * @throws LockTimeoutException if pessimistic locking
+ * fails and only the statement is rolled back
+ */
public Object getSingleResult();
+ /**
+ * Execute an update or delete statement.
+ * @return the number of entities updated or deleted
+ * @throws IllegalStateException if called for a Java
+ * Persistence query language SELECT statement or for
+ *a criteria query
+ * @throws TransactionRequiredException if there is
+ * no transaction
+ * @throws QueryTimeoutException if the statement execution
+ exceeds the query timeout value set
+ */
public int executeUpdate();
+ /**
+ * Set the maximum number of results to retrieve.
+ * @param maxResult
+ * @return the same query instance
+ * @throws IllegalArgumentException if argument is negative
+ */
public Query setMaxResults(int maxResult);
+ /**
+ * The maximum number of results the query object was set to
+ * retrieve. Returns Integer.MAX_VALUE if setMaxResults was not
+ * applied to the query object.
+ * @return maximum number of results
+ */
+ public int getMaxResults();
+ /**
+ * Set the position of the first result to retrieve.
+ * @param start position of the first result, numbered from 0
+ * @return the same query instance
+ * @throws IllegalArgumentException if argument is negative
+ */
public Query setFirstResult(int startPosition);
-
- public Query setFlushMode(FlushModeType flushModeType);
-
+ /**
+ * The position of the first result the query object was set to
+ * retrieve. Returns 0 if setFirstResult was not applied to the
+ * query object.
+ * @return position of first result
+ */
+ public int getFirstResult();
+ /**
+ * Set a query hint.
+ * If a vendor-specific hint is not recognized, it is silently
+ * ignored.
+ * Portable applications should not rely on the standard timeout
+ * hint. Depending on the database in use and the locking
+ * mechanisms used by the provider, the hint may or may not
+ * be observed.
+ * @param hintName
+ * @param value
+ * @return the same query instance
+ *
+ * * @throws IllegalArgumentException if the second argument is not
+ * valid for the implementation
+ */
public Query setHint(String hintName, Object value);
+ /**
+ * Get the hints and associated values that are in effect for
+ * the query instance.
+ * @return query hints
+ */
+ public Map<String, Object> getHints();
+ /**
+ * Get the names of the hints that are supported for query
+ * objects. These hints correspond to hints that may be passed
+ * to the methods of the Query interface that take hints as
+ * arguments or used with the NamedQuery and NamedNativeQuery
+ * annotations. These include all standard query hints as well as
+ * vendor-specific hints supported by the provider. These hints
+ * may or may not currently be in effect.
+ * @return hints
+ */
+ public Set<String> getSupportedHints();
+ /**
+ * Bind an argument to a named parameter.
+ * @param name the parameter name
+ * @param value
+ * @return the same query instance
+ * @throws IllegalArgumentException if parameter name does not
+ * correspond to parameter in query string
+ * or argument is of incorrect type
+ */
public Query setParameter(String name, Object value);
- public Query setParameter(String name, Date value, TemporalType temporalType);
-
- public Query setParameter(String name, Calendar value, TemporalType temporalType);
-
+ /**
+ * Bind an instance of java.util.Date to a named parameter.
+ * @param name
+ * @param value
+ * @param temporalType
+ * @return the same query instance
+ * @throws IllegalArgumentException if parameter name does not
+ *correspond to parameter in query string
+ */
+ public Query setParameter(String name, Date value,
+ TemporalType temporalType);
+ /**
+ * Bind an instance of java.util.Calendar to a named parameter.
+ * @param name
+ * @param value
+ * @param temporalType
+ * @return the same query instance
+ * @throws IllegalArgumentException if parameter name does not
+ *correspond to parameter in query string
+ */
+ public Query setParameter(String name, Calendar value,
+ TemporalType temporalType);
+ /**
+ * Bind an argument to a positional parameter.
+ * @param position
+ * @param value
+ * @return the same query instance
+ * @throws IllegalArgumentException if position does not
+ *correspond to positional parameter of query
+ *or argument is of incorrect type
+ */
public Query setParameter(int position, Object value);
- public Query setParameter(int position, Date value, TemporalType temporalType);
-
- public Query setParameter(int position, Calendar value, TemporalType temporalType);
+ /**
+ * Bind an instance of java.util.Date to a positional parameter.
+ * @param position
+ * @param value
+ * @param temporalType
+ * @return the same query instance
+ * @throws IllegalArgumentException if position does not
+ *correspond to positional parameter of query
+ */
+ public Query setParameter(int position, Date value,
+ TemporalType temporalType);
+ /**
+ * Bind an instance of java.util.Calendar to a positional
+ * parameter.
+ * @param position
+ * @param value
+ * @param temporalType
+ * @return the same query instance
+ * @throws IllegalArgumentException if position does not
+ * correspond to positional parameter of query
+ */
+ public Query setParameter(int position, Calendar value,
+ TemporalType temporalType);
+ /**
+ * Get the parameters names and associated values of the
+ * parameters that are bound for the query instance.
+ * Returns empty map if no parameters have been bound
+ * or if the query does not use named parameters.
+ * @return named parameters
+ */
+ public Map<String, Object> getNamedParameters();
+ /**
+ * Get the values of the positional parameters
+ * that are bound for the query instance.
+ * Positional positions are listed in order of position.
+ * Returns empty list if no parameters have been bound
+ * or if the query does not use positional parameters.
+ * @return positional parameters
+ */
+ public List getPositionalParameters();
+ /**
+ * Set the flush mode type to be used for the query execution.
+ * The flush mode type applies to the query regardless of the
+ * flush mode type in use for the entity manager.
+ * @param flushMode
+ */
+ public Query setFlushMode(FlushModeType flushMode);
+ /**
+ * The flush mode in effect for the query execution. If a flush
+ * mode has not been set for the query object, returns the flush
+ * mode in effect for the entity manager.
+ * @return flush mode
+ */
+ public FlushModeType getFlushMode();
+ /**
+ * Set the lock mode type to be used for the query execution.
+ * @param lockMode
+ * @throws IllegalStateException if not a Java Persistence
+ * query language SELECT query or Criteria API query
+ */
+ public Query setLockMode(LockModeType lockMode);
+ /**
+ * Get the current lock mode for the query.
+ * @return lock mode
+ * @throws IllegalStateException if not a Java Persistence
+ * query language SELECT query or Criteria API query
+ */
+ public LockModeType getLockMode();
+ /**
+ * Return an object of the specified type to allow access to the
+ * provider-specific API. If the provider's Query implementation
+ * does not support the specified class, the PersistenceException
+ * is thrown.
+ * @param cls the class of the object to be returned. This is
+ * normally either the underlying Query implementation class
+ * or an interface that it implements.
+ * @return an instance of the specified class
+ * @throws PersistenceException if the provider does not support
+ * the call.
+ */
+ public <T> T unwrap(Class<T> cls);
}