diff --git a/hibernate-core/src/main/java/org/hibernate/FlushMode.java b/hibernate-core/src/main/java/org/hibernate/FlushMode.java index f1ad4f76a1..8a0dbacb93 100644 --- a/hibernate-core/src/main/java/org/hibernate/FlushMode.java +++ b/hibernate-core/src/main/java/org/hibernate/FlushMode.java @@ -89,7 +89,7 @@ public enum FlushMode { } /** - * Checks to see if the given mode is the same as {@link #MANUAL} + * Checks to see if the given mode is the same as {@link #MANUAL}. * * @param mode The mode to check * diff --git a/hibernate-core/src/main/java/org/hibernate/InstantiationException.java b/hibernate-core/src/main/java/org/hibernate/InstantiationException.java index 3489ad649d..fdfafa18eb 100644 --- a/hibernate-core/src/main/java/org/hibernate/InstantiationException.java +++ b/hibernate-core/src/main/java/org/hibernate/InstantiationException.java @@ -66,7 +66,11 @@ public class InstantiationException extends HibernateException { } /** + * Returns the Class we were attempting to instantiate. + * * @deprecated Use {@link #getUninstantiatableClass} instead + * + * @return The class we are unable to instantiate */ @Deprecated public Class getPersistentClass() { diff --git a/hibernate-core/src/main/java/org/hibernate/JDBCException.java b/hibernate-core/src/main/java/org/hibernate/JDBCException.java index 12de808328..922657d10e 100644 --- a/hibernate-core/src/main/java/org/hibernate/JDBCException.java +++ b/hibernate-core/src/main/java/org/hibernate/JDBCException.java @@ -37,7 +37,7 @@ public class JDBCException extends HibernateException { private final String sql; /** - * Constructs a JDBCException using the given information + * Constructs a JDBCException using the given information. * * @param message The message explaining the exception condition * @param cause The underlying cause @@ -46,41 +46,54 @@ public class JDBCException extends HibernateException { this( message, cause, null ); } - public JDBCException(String string, SQLException cause, String sql) { - super( string, cause ); + /** + * Constructs a JDBCException using the given information. + * + * @param message The message explaining the exception condition + * @param cause The underlying cause + * @param sql The sql being executed when the exception occurred + */ + public JDBCException(String message, SQLException cause, String sql) { + super( message, cause ); this.sqlException = cause; this.sql = sql; } /** - * Get the SQLState of the underlying SQLException. - * @see java.sql.SQLException - * @return String + * Get the X/Open or ANSI SQL SQLState error code from the underlying {@link SQLException}. + * + * @return The X/Open or ANSI SQL SQLState error code; may return null. + * + * @see java.sql.SQLException#getSQLState() */ public String getSQLState() { return sqlException.getSQLState(); } /** - * Get the errorCode of the underlying SQLException. - * @see java.sql.SQLException - * @return int the error code + * Get the vendor specific error code from the underlying {@link SQLException}. + * + * @return The vendor specific error code + * + * @see java.sql.SQLException#getErrorCode() */ public int getErrorCode() { return sqlException.getErrorCode(); } /** - * Get the underlying SQLException. - * @return SQLException + * Get the underlying {@link SQLException}. + * + * @return The SQLException */ public SQLException getSQLException() { return sqlException; } /** - * Get the actual SQL statement that caused the exception - * (may be null) + * Get the actual SQL statement being executed when the exception occurred. + * + * @return The SQL statement; may return null. */ public String getSQL() { return sql; diff --git a/hibernate-core/src/main/java/org/hibernate/LazyInitializationException.java b/hibernate-core/src/main/java/org/hibernate/LazyInitializationException.java index 5fc07fa4b8..e4f801173a 100644 --- a/hibernate-core/src/main/java/org/hibernate/LazyInitializationException.java +++ b/hibernate-core/src/main/java/org/hibernate/LazyInitializationException.java @@ -44,7 +44,7 @@ public class LazyInitializationException extends HibernateException { ); /** - * Constructs a LazyInitializationException using the given message + * Constructs a LazyInitializationException using the given message. * * @param message A message explaining the exception condition */ diff --git a/hibernate-core/src/main/java/org/hibernate/LockOptions.java b/hibernate-core/src/main/java/org/hibernate/LockOptions.java index 849e72657a..c49aec626a 100644 --- a/hibernate-core/src/main/java/org/hibernate/LockOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/LockOptions.java @@ -75,13 +75,13 @@ public class LockOptions implements Serializable { private Map aliasSpecificLockModes; /** - * Constructs a LockOptions with all default options + * Constructs a LockOptions with all default options. */ public LockOptions() { } /** - * Constructs a LockOptions with the given lock mode + * Constructs a LockOptions with the given lock mode. * * @param lockMode The lock mode to use */ @@ -173,6 +173,11 @@ public class LockOptions implements Serializable { return lockMode == null ? LockMode.NONE : lockMode; } + /** + * Does this LockOptions object define alias-specific lock modes? + * + * @return {@code true} if this LockOptions object define alias-specific lock modes; {@code false} otherwise. + */ public boolean hasAliasSpecificLockModes() { return aliasSpecificLockModes != null && ! aliasSpecificLockModes.isEmpty(); @@ -203,7 +208,7 @@ public class LockOptions implements Serializable { } /** - * Currently needed for follow-on locking + * Currently needed for follow-on locking. * * @return The greatest of all requested lock modes. */ @@ -256,7 +261,7 @@ public class LockOptions implements Serializable { return this; } - private boolean scope=false; + private boolean scope; /** * Retrieve the current lock scope setting. @@ -293,7 +298,7 @@ public class LockOptions implements Serializable { } /** - * Perform a shallow copy + * Perform a shallow copy. * * @param source Source for the copy (copied from) * @param destination Destination for the copy (copied to) diff --git a/hibernate-core/src/main/java/org/hibernate/MappingException.java b/hibernate-core/src/main/java/org/hibernate/MappingException.java index fc818a55a4..31d6aec618 100644 --- a/hibernate-core/src/main/java/org/hibernate/MappingException.java +++ b/hibernate-core/src/main/java/org/hibernate/MappingException.java @@ -31,7 +31,7 @@ package org.hibernate; */ public class MappingException extends HibernateException { /** - * Constructs a MappingException using the given information + * Constructs a MappingException using the given information. * * @param message A message explaining the exception condition * @param cause The underlying cause @@ -41,7 +41,7 @@ public class MappingException extends HibernateException { } /** - * Constructs a MappingException using the given information + * Constructs a MappingException using the given information. * * @param cause The underlying cause */ @@ -50,7 +50,7 @@ public class MappingException extends HibernateException { } /** - * Constructs a MappingException using the given information + * Constructs a MappingException using the given information. * * @param message A message explaining the exception condition */ diff --git a/hibernate-core/src/main/java/org/hibernate/MultiTenancyStrategy.java b/hibernate-core/src/main/java/org/hibernate/MultiTenancyStrategy.java index 16d0f9c220..9cd26fd450 100644 --- a/hibernate-core/src/main/java/org/hibernate/MultiTenancyStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/MultiTenancyStrategy.java @@ -61,7 +61,7 @@ public enum MultiTenancyStrategy { /** * Does this strategy indicate a requirement for the specialized * {@link org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider}, rather than the - * traditional {@link org.hibernate.engine.jdbc.connections.spi.ConnectionProvider} + * traditional {@link org.hibernate.engine.jdbc.connections.spi.ConnectionProvider}? * * @return {@code true} indicates a MultiTenantConnectionProvider is required; {@code false} indicates it is not. */ diff --git a/hibernate-core/src/main/java/org/hibernate/NonUniqueObjectException.java b/hibernate-core/src/main/java/org/hibernate/NonUniqueObjectException.java index b852f706bd..ccc676db4d 100644 --- a/hibernate-core/src/main/java/org/hibernate/NonUniqueObjectException.java +++ b/hibernate-core/src/main/java/org/hibernate/NonUniqueObjectException.java @@ -52,7 +52,7 @@ public class NonUniqueObjectException extends HibernateException { } /** - * Constructs a NonUniqueObjectException using the given information, using a standard message + * Constructs a NonUniqueObjectException using the given information, using a standard message. * * @param entityId The identifier of the entity * @param entityName The name of the entity diff --git a/hibernate-core/src/main/java/org/hibernate/NonUniqueResultException.java b/hibernate-core/src/main/java/org/hibernate/NonUniqueResultException.java index 5e7145115e..a7cf8c4682 100644 --- a/hibernate-core/src/main/java/org/hibernate/NonUniqueResultException.java +++ b/hibernate-core/src/main/java/org/hibernate/NonUniqueResultException.java @@ -32,7 +32,7 @@ package org.hibernate; */ public class NonUniqueResultException extends HibernateException { /** - * Constructs a NonUniqueResultException + * Constructs a NonUniqueResultException. * * @param resultCount The number of actual results. */ diff --git a/hibernate-core/src/main/java/org/hibernate/ObjectDeletedException.java b/hibernate-core/src/main/java/org/hibernate/ObjectDeletedException.java index 3a41929d95..dff4130c05 100644 --- a/hibernate-core/src/main/java/org/hibernate/ObjectDeletedException.java +++ b/hibernate-core/src/main/java/org/hibernate/ObjectDeletedException.java @@ -32,7 +32,7 @@ import java.io.Serializable; */ public class ObjectDeletedException extends UnresolvableObjectException { /** - * Constructs an ObjectDeletedException using the given information + * Constructs an ObjectDeletedException using the given information. * * @param message A message explaining the exception condition * @param identifier The identifier of the entity diff --git a/hibernate-core/src/main/java/org/hibernate/OptimisticLockException.java b/hibernate-core/src/main/java/org/hibernate/OptimisticLockException.java index 396807f657..2960609f2f 100644 --- a/hibernate-core/src/main/java/org/hibernate/OptimisticLockException.java +++ b/hibernate-core/src/main/java/org/hibernate/OptimisticLockException.java @@ -35,7 +35,7 @@ import org.hibernate.dialect.lock.OptimisticEntityLockException; @Deprecated public class OptimisticLockException extends OptimisticEntityLockException { /** - * Constructs a OptimisticLockException using the specified information + * Constructs a OptimisticLockException using the specified information. * * @param entity The entity instance that could not be locked * @param message A message explaining the exception condition diff --git a/hibernate-core/src/main/java/org/hibernate/PessimisticLockException.java b/hibernate-core/src/main/java/org/hibernate/PessimisticLockException.java index 260fb790ef..7bef92625a 100644 --- a/hibernate-core/src/main/java/org/hibernate/PessimisticLockException.java +++ b/hibernate-core/src/main/java/org/hibernate/PessimisticLockException.java @@ -32,7 +32,7 @@ import java.sql.SQLException; */ public class PessimisticLockException extends JDBCException { /** - * Constructs a PessimisticLockException using the specified information + * Constructs a PessimisticLockException using the specified information. * * @param message A message explaining the exception condition * @param sqlException The underlying SQL exception diff --git a/hibernate-core/src/main/java/org/hibernate/Query.java b/hibernate-core/src/main/java/org/hibernate/Query.java index 8f2a1f7d4f..3005aa96d0 100644 --- a/hibernate-core/src/main/java/org/hibernate/Query.java +++ b/hibernate-core/src/main/java/org/hibernate/Query.java @@ -77,6 +77,7 @@ import org.hibernate.type.Type; * * @author Gavin King */ +@SuppressWarnings("UnusedDeclaration") public interface Query extends BasicQueryContract { /** * Get the query string. @@ -163,6 +164,8 @@ public interface Query extends BasicQueryContract { * * For alias-specific locking, use {@link #setLockMode(String, LockMode)}. * + * @param lockOptions The lock options to apply to the query. + * * @return {@code this}, for method chaining * * @see #getLockOptions() @@ -179,7 +182,8 @@ public interface Query extends BasicQueryContract { * speaking, for maximum portability, this method should only be used to mark that the rows corresponding to * the given alias should be included in pessimistic locking ({@link LockMode#PESSIMISTIC_WRITE}). * - * @param alias a query alias, or this for a collection filter + * @param alias a query alias, or {@code "this"} for a collection filter + * @param lockMode The lock mode to apply. * * @return {@code this}, for method chaining * @@ -209,7 +213,7 @@ public interface Query extends BasicQueryContract { public Query setComment(String comment); /** - * Return the HQL select clause aliases (if any) + * Return the HQL select clause aliases, if any. * * @return an array of aliases as strings */ @@ -246,14 +250,16 @@ public interface Query extends BasicQueryContract { public ScrollableResults scroll(); /** - * Return the query results as ScrollableResults. The - * scrollability of the returned results depends upon JDBC driver - * support for scrollable ResultSets.
+ * Return the query results as ScrollableResults. The scrollability of the returned results + * depends upon JDBC driver support for scrollable ResultSets. + * + * @param scrollMode The scroll mode + * + * @return the result iterator * * @see ScrollableResults * @see ScrollMode * - * @return the result iterator */ public ScrollableResults scroll(ScrollMode scrollMode); @@ -278,9 +284,8 @@ public interface Query extends BasicQueryContract { /** * Execute the update or delete statement. - *

- * The semantics are compliant with the ejb3 Query.executeUpdate() - * method. + * + * The semantics are compliant with the ejb3 Query.executeUpdate() method. * * @return The number of entities updated or deleted. */ @@ -407,7 +412,7 @@ public interface Query extends BasicQueryContract { * * @return {@code this}, for method chaining */ - public Query setProperties(Object bean) throws HibernateException; + public Query setProperties(Object bean); /** * Bind the values of the given Map for each named parameters of the query, @@ -418,45 +423,356 @@ public interface Query extends BasicQueryContract { * * @return {@code this}, for method chaining */ - public Query setProperties(Map bean) throws HibernateException; + public Query setProperties(Map bean); + /** + * Bind a positional String-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setString(int position, String val); + + /** + * Bind a positional char-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setCharacter(int position, char val); + + /** + * Bind a positional boolean-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setBoolean(int position, boolean val); + + /** + * Bind a positional byte-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setByte(int position, byte val); + + /** + * Bind a positional short-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setShort(int position, short val); + + /** + * Bind a positional int-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setInteger(int position, int val); + + /** + * Bind a positional long-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setLong(int position, long val); + + /** + * Bind a positional float-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setFloat(int position, float val); + + /** + * Bind a positional double-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setDouble(int position, double val); + + /** + * Bind a positional binary-valued parameter. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setBinary(int position, byte[] val); + + /** + * Bind a positional String-valued parameter using streaming. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setText(int position, String val); + + /** + * Bind a positional binary-valued parameter using serialization. + * + * @param position The parameter position + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setSerializable(int position, Serializable val); + + /** + * Bind a positional Locale-valued parameter. + * + * @param position The parameter position + * @param locale The bind value + * + * @return {@code this}, for method chaining + */ public Query setLocale(int position, Locale locale); + + /** + * Bind a positional BigDecimal-valued parameter. + * + * @param position The parameter position + * @param number The bind value + * + * @return {@code this}, for method chaining + */ public Query setBigDecimal(int position, BigDecimal number); + + /** + * Bind a positional BigDecimal-valued parameter. + * + * @param position The parameter position + * @param number The bind value + * + * @return {@code this}, for method chaining + */ public Query setBigInteger(int position, BigInteger number); + /** + * Bind a positional Date-valued parameter using just the Date portion. + * + * @param position The parameter position + * @param date The bind value + * + * @return {@code this}, for method chaining + */ public Query setDate(int position, Date date); + + /** + * Bind a positional Date-valued parameter using just the Time portion. + * + * @param position The parameter position + * @param date The bind value + * + * @return {@code this}, for method chaining + */ public Query setTime(int position, Date date); + + /** + * Bind a positional Date-valued parameter using the full Timestamp. + * + * @param position The parameter position + * @param date The bind value + * + * @return {@code this}, for method chaining + */ public Query setTimestamp(int position, Date date); + /** + * Bind a positional Calendar-valued parameter using the full Timestamp portion. + * + * @param position The parameter position + * @param calendar The bind value + * + * @return {@code this}, for method chaining + */ public Query setCalendar(int position, Calendar calendar); + + /** + * Bind a positional Calendar-valued parameter using just the Date portion. + * + * @param position The parameter position + * @param calendar The bind value + * + * @return {@code this}, for method chaining + */ public Query setCalendarDate(int position, Calendar calendar); + /** + * Bind a named String-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setString(String name, String val); + + /** + * Bind a named char-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setCharacter(String name, char val); + + /** + * Bind a named boolean-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setBoolean(String name, boolean val); + + /** + * Bind a named byte-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setByte(String name, byte val); + + /** + * Bind a named short-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setShort(String name, short val); + + /** + * Bind a named int-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setInteger(String name, int val); + + /** + * Bind a named long-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setLong(String name, long val); + + /** + * Bind a named float-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setFloat(String name, float val); + + /** + * Bind a named double-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setDouble(String name, double val); + + /** + * Bind a named binary-valued parameter. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setBinary(String name, byte[] val); + + /** + * Bind a named String-valued parameter using streaming. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setText(String name, String val); + + /** + * Bind a named binary-valued parameter using serialization. + * + * @param name The parameter name + * @param val The bind value + * + * @return {@code this}, for method chaining + */ public Query setSerializable(String name, Serializable val); + + /** + * Bind a named Locale-valued parameter. + * + * @param name The parameter name + * @param locale The bind value + * + * @return {@code this}, for method chaining + */ public Query setLocale(String name, Locale locale); + + /** + * Bind a named BigDecimal-valued parameter. + * + * @param name The parameter name + * @param number The bind value + * + * @return {@code this}, for method chaining + */ public Query setBigDecimal(String name, BigDecimal number); + + /** + * Bind a named BigInteger-valued parameter. + * + * @param name The parameter name + * @param number The bind value + * + * @return {@code this}, for method chaining + */ public Query setBigInteger(String name, BigInteger number); /** @@ -489,11 +805,29 @@ public interface Query extends BasicQueryContract { */ public Query setTimestamp(String name, Date date); + /** + * Bind a named Calendar-valued parameter using the full Timestamp. + * + * @param name The parameter name + * @param calendar The bind value + * + * @return {@code this}, for method chaining + */ public Query setCalendar(String name, Calendar calendar); + + /** + * Bind a named Calendar-valued parameter using just the Date portion. + * + * @param name The parameter name + * @param calendar The bind value + * + * @return {@code this}, for method chaining + */ public Query setCalendarDate(String name, Calendar calendar); /** * Bind an instance of a mapped persistent class to a JDBC-style query parameter. + * Use {@link #setParameter(int, Object)} for null values. * * @param position the position of the parameter in the query * string, numbered from 0. @@ -501,17 +835,18 @@ public interface Query extends BasicQueryContract { * * @return {@code this}, for method chaining */ - public Query setEntity(int position, Object val); // use setParameter for null values + public Query setEntity(int position, Object val); /** - * Bind an instance of a mapped persistent class to a named query parameter. + * Bind an instance of a mapped persistent class to a named query parameter. Use + * {@link #setParameter(String, Object)} for null values. * * @param name the name of the parameter * @param val a non-null instance of a persistent class * * @return {@code this}, for method chaining */ - public Query setEntity(String name, Object val); // use setParameter for null values + public Query setEntity(String name, Object val); /** diff --git a/hibernate-core/src/main/java/org/hibernate/QueryException.java b/hibernate-core/src/main/java/org/hibernate/QueryException.java index 79cc8cab62..fd20591a22 100644 --- a/hibernate-core/src/main/java/org/hibernate/QueryException.java +++ b/hibernate-core/src/main/java/org/hibernate/QueryException.java @@ -34,7 +34,7 @@ public class QueryException extends HibernateException { private String queryString; /** - * Constructs a QueryException using the specified exception message + * Constructs a QueryException using the specified exception message. * * @param message A message explaining the exception condition */ @@ -43,7 +43,7 @@ public class QueryException extends HibernateException { } /** - * Constructs a QueryException using the specified exception message and cause + * Constructs a QueryException using the specified exception message and cause. * * @param message A message explaining the exception condition * @param cause The underlying cause @@ -53,7 +53,7 @@ public class QueryException extends HibernateException { } /** - * Constructs a QueryException using the specified exception message and query-string + * Constructs a QueryException using the specified exception message and query-string. * * @param message A message explaining the exception condition * @param queryString The query being evaluated when the exception occurred @@ -64,7 +64,7 @@ public class QueryException extends HibernateException { } /** - * Constructs a QueryException using the specified cause + * Constructs a QueryException using the specified cause. * * @param cause The underlying cause */ @@ -82,7 +82,7 @@ public class QueryException extends HibernateException { } /** - * Set the query string. EVen an option, since often the part of the code generating the exception does not + * Set the query string. Even an option since often the part of the code generating the exception does not * have access to the query overall. * * @param queryString The query string. @@ -108,10 +108,3 @@ public class QueryException extends HibernateException { } } - - - - - - - diff --git a/hibernate-core/src/main/java/org/hibernate/QueryParameterException.java b/hibernate-core/src/main/java/org/hibernate/QueryParameterException.java index 72d08eae15..92998c0029 100644 --- a/hibernate-core/src/main/java/org/hibernate/QueryParameterException.java +++ b/hibernate-core/src/main/java/org/hibernate/QueryParameterException.java @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, Red Hat Inc. or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU @@ -20,31 +20,21 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ -package org.hibernate; - +package org.hibernate; /** - * Parameter invalid or not found in the query + * Parameter invalid or not found in the query. * * @author Emmanuel Bernard */ public class QueryParameterException extends QueryException { - - public QueryParameterException(Exception e) { - super( e ); - } - + /** + * Constructs a QueryParameterException using the supplied exception message. + * + * @param message The message explaining the exception condition + */ public QueryParameterException(String message) { super( message ); } - - public QueryParameterException(String message, Throwable e) { - super( message, e ); - } - - public QueryParameterException(String message, String queryString) { - super( message, queryString ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/QueryTimeoutException.java b/hibernate-core/src/main/java/org/hibernate/QueryTimeoutException.java index cc65680f0b..666833fbb3 100644 --- a/hibernate-core/src/main/java/org/hibernate/QueryTimeoutException.java +++ b/hibernate-core/src/main/java/org/hibernate/QueryTimeoutException.java @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2009, 2013, Red Hat Inc. or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU @@ -20,26 +20,26 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; + import java.sql.SQLException; /** - * * Thrown when a database query timeout occurs. * * @author Scott Marlow */ - public class QueryTimeoutException extends JDBCException { - - public QueryTimeoutException( String s, JDBCException je, String sql ) { - super(s, je.getSQLException(), sql); - } - - public QueryTimeoutException( String s, SQLException se, String sql ) { - super(s, se, sql); + /** + * Constructs a QueryTimeoutException using the supplied information. + * + * @param message The message explaining the exception condition + * @param sqlException The underlying SQLException + * @param sql The sql being executed when the exception occurred. + */ + public QueryTimeoutException(String message, SQLException sqlException, String sql) { + super(message, sqlException, sql); } } diff --git a/hibernate-core/src/main/java/org/hibernate/ReplicationMode.java b/hibernate-core/src/main/java/org/hibernate/ReplicationMode.java index 4e18a2bad1..c299eca453 100644 --- a/hibernate-core/src/main/java/org/hibernate/ReplicationMode.java +++ b/hibernate-core/src/main/java/org/hibernate/ReplicationMode.java @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, Red Hat Inc. or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU @@ -20,7 +20,6 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; @@ -37,6 +36,7 @@ public enum ReplicationMode { * Throw an exception when a row already exists. */ EXCEPTION { + @Override public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) { throw new AssertionFailure( "should not be called" ); } @@ -45,6 +45,7 @@ public enum ReplicationMode { * Ignore replicated entities when a row already exists. */ IGNORE { + @Override public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) { return false; } @@ -53,6 +54,7 @@ public enum ReplicationMode { * Overwrite existing rows when a row already exists. */ OVERWRITE { + @Override public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) { return true; } @@ -61,17 +63,26 @@ public enum ReplicationMode { * When a row already exists, choose the latest version. */ LATEST_VERSION { + @Override + @SuppressWarnings("unchecked") public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) { - if ( versionType == null ) { - return true; //always overwrite nonversioned data - } - return versionType.getComparator().compare( currentVersion, newVersion ) <= 0; + // always overwrite non-versioned data (because we don't know which is newer) + return versionType == null || versionType.getComparator().compare( currentVersion, newVersion ) <= 0; } }; + /** + * Determine whether the mode dictates that the data being replicated should overwrite the data found. + * + * @param entity The entity being replicated + * @param currentVersion The version currently on the target database table. + * @param newVersion The replicating version + * @param versionType The version type + * + * @return {@code true} indicates the data should be overwritten; {@code false} indicates it should not. + */ public abstract boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType); - } diff --git a/hibernate-core/src/main/java/org/hibernate/ResourceClosedException.java b/hibernate-core/src/main/java/org/hibernate/ResourceClosedException.java index 800d478cf0..d1182344f4 100644 --- a/hibernate-core/src/main/java/org/hibernate/ResourceClosedException.java +++ b/hibernate-core/src/main/java/org/hibernate/ResourceClosedException.java @@ -29,11 +29,12 @@ package org.hibernate; * @author Steve Ebersole */ public class ResourceClosedException extends HibernateException { - public ResourceClosedException(String s) { - super( s ); - } - - public ResourceClosedException(String string, Throwable root) { - super( string, root ); + /** + * Constructs a ResourceClosedException using the supplied message. + * + * @param message The message explaining the exception condition + */ + public ResourceClosedException(String message) { + super( message ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/SQLQuery.java b/hibernate-core/src/main/java/org/hibernate/SQLQuery.java index 4938546a27..b38ee8d83d 100755 --- a/hibernate-core/src/main/java/org/hibernate/SQLQuery.java +++ b/hibernate-core/src/main/java/org/hibernate/SQLQuery.java @@ -28,20 +28,33 @@ import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn; import org.hibernate.type.Type; /** - * Represents a "native sql" query and allows the user to define certain aspects about its execution, such as: - *

- * In terms of result-set mapping, there are 3 approaches to defining: