Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12589
Modified Files:
HibernateTemplate.cs HibernateTransactionManager.cs
ICommonHibernateOperations.cs IHibernateCallback.cs
IHibernateOperations.cs SessionFactoryUtils.cs
Log Message:
SPRNET-729 - Improve API documentation in NHibernate12 project using comment-checker program
SPRNET-728 - Add missing ExecuteFind<T> method on IHibernateOperations interface
Index: IHibernateCallback.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/IHibernateCallback.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IHibernateCallback.cs 31 May 2007 20:25:13 -0000 1.1
--- IHibernateCallback.cs 19 Sep 2007 22:58:22 -0000 1.2
***************
*** 52,55 ****
--- 52,56 ----
/// </p>
/// </remarks>
+ /// <returns>A result object, or null if none.</returns>
object DoInHibernate(ISession session);
}
Index: ICommonHibernateOperations.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/ICommonHibernateOperations.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ICommonHibernateOperations.cs 31 May 2007 20:25:13 -0000 1.1
--- ICommonHibernateOperations.cs 19 Sep 2007 22:58:22 -0000 1.2
***************
*** 24,27 ****
--- 24,28 ----
using NHibernate;
using NHibernate.Type;
+ using Spring.Dao;
#endregion
***************
*** 41,45 ****
/// for details on those methods.
/// </p>
! /// </remarks>
public interface ICommonHibernateOperations
{
--- 42,49 ----
/// for details on those methods.
/// </p>
! /// </remarks>
! /// <author>Mark Pollack (.NET)</author>
! /// <threadsafety statis="true" instance="true"/>
! /// <version>$Id$</version>
public interface ICommonHibernateOperations
{
***************
*** 48,58 ****
/// updates and deletes.
/// </summary>
void Clear();
- //TODO:
- //void CloseIterator();
-
-
-
/// <summary>
--- 52,58 ----
/// updates and deletes.
/// </summary>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Clear();
/// <summary>
***************
*** 60,63 ****
--- 60,64 ----
/// </summary>
/// <param name="entity">The persistent instance to delete.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Delete(object entity);
***************
*** 72,75 ****
--- 73,77 ----
/// <param name="entity">Tthe persistent instance to delete.</param>
/// <param name="lockMode">The lock mode to obtain.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Delete(object entity, LockMode lockMode);
***************
*** 80,83 ****
--- 82,86 ----
/// <param name="queryString">a query expressed in Hibernate's query language.</param>
/// <returns>The number of entity instances deleted.</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
int Delete(string queryString);
***************
*** 89,92 ****
--- 92,96 ----
/// <param name="type">The Hibernate type of the parameter (or <code>null</code>).</param>
/// <returns>The number of entity instances deleted.</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
int Delete(string queryString, object value, IType type);
***************
*** 99,102 ****
--- 103,107 ----
/// <param name="types"> Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>The number of entity instances deleted.</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
int Delete(String queryString, Object[] values, IType[] types);
***************
*** 110,113 ****
--- 115,119 ----
/// to rely on auto-flushing at transaction completion.
/// </remarks>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Flush();
***************
*** 120,123 ****
--- 126,131 ----
/// <param name="entity">Entity the object (of the target class) to load into.</param>
/// <param name="id">An identifier of the persistent instance.</param>
+ /// <exception cref="ObjectRetrievalFailureException">If object not found.</exception>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Load(object entity, object id);
***************
*** 127,130 ****
--- 135,139 ----
/// </summary>
/// <param name="entity">The persistent instance to re-read.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Refresh(object entity);
***************
*** 135,138 ****
--- 144,148 ----
/// <param name="entity">The persistent instance to re-read.</param>
/// <param name="lockMode">The lock mode to obtain.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Refresh(object entity, LockMode lockMode);
***************
*** 144,147 ****
--- 154,158 ----
/// <c>true</c> if session cache contains the specified entity; otherwise, <c>false</c>.
/// </returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
bool Contains(object entity);
***************
*** 150,155 ****
--- 161,169 ----
/// </summary>
/// <param name="entity">The persistent instance to evict.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Evict(object entity);
+ #endregion
+
#region Convenience methods for storing individual objects
***************
*** 162,165 ****
--- 176,181 ----
/// <param name="entity">The he persistent instance to lock.</param>
/// <param name="lockMode">The lock mode to obtain.</param>
+ /// <exception cref="ObjectOptimisticLockingFailureException">If not found</exception>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Lock(object entity, LockMode lockMode);
***************
*** 170,173 ****
--- 186,190 ----
/// <param name="entity">The transient instance to persist.</param>
/// <returns>The generated identifier.</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
object Save(object entity);
***************
*** 177,180 ****
--- 194,198 ----
/// <param name="entity">The transient instance to persist.</param>
/// <param name="id">The identifier to assign.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Save(object entity, object id);
***************
*** 183,186 ****
--- 201,205 ----
/// </summary>
/// <param name="entity">The persistent instance to update.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Update(object entity);
***************
*** 193,196 ****
--- 212,216 ----
/// <param name="entity">The persistent instance to update.</param>
/// <param name="lockMode">The lock mode to obtain.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Update(object entity, LockMode lockMode);
***************
*** 201,204 ****
--- 221,225 ----
/// <param name="entity">Tthe persistent instance to save or update
/// (to be associated with the Hibernate Session).</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void SaveOrUpdate(object entity);
***************
*** 214,217 ****
--- 235,239 ----
/// <returns>The actually associated persistent object.
/// (either an already loaded instance with the same id, or the given object)</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
object SaveOrUpdateCopy(object entity);
***************
*** 219,223 ****
#endregion
! #endregion
}
}
--- 241,245 ----
#endregion
!
}
}
Index: IHibernateOperations.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/IHibernateOperations.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IHibernateOperations.cs 31 May 2007 20:25:13 -0000 1.1
--- IHibernateOperations.cs 19 Sep 2007 22:58:22 -0000 1.2
***************
*** 25,28 ****
--- 25,29 ----
using NHibernate;
using NHibernate.Type;
+ using Spring.Dao;
using Spring.Data.NHibernate;
***************
*** 42,58 ****
/// </p>
/// </remarks>
/// <author>Mark Pollack (.NET)</author>
/// <version>$Id$</version>
public interface IHibernateOperations : ICommonHibernateOperations
{
!
/// <summary>
/// Delete all given persistent instances.
/// </summary>
/// <remarks>
/// This can be combined with any of the find methods to delete by query
/// in two lines of code, similar to Session's delete by query methods.
/// </remarks>
! /// <param name="entities">The persistent instances to delete.</param>
void DeleteAll(ICollection entities);
--- 43,61 ----
/// </p>
/// </remarks>
+ /// <threadsafety statis="true" instance="true"/>
/// <author>Mark Pollack (.NET)</author>
/// <version>$Id$</version>
public interface IHibernateOperations : ICommonHibernateOperations
{
!
/// <summary>
/// Delete all given persistent instances.
/// </summary>
+ /// <param name="entities">The persistent instances to delete.</param>
/// <remarks>
/// This can be combined with any of the find methods to delete by query
/// in two lines of code, similar to Session's delete by query methods.
/// </remarks>
! /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void DeleteAll(ICollection entities);
***************
*** 74,77 ****
--- 77,81 ----
/// <returns>a result object returned by the action, or <code>null</code>
/// </returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
object Execute(HibernateDelegate del);
***************
*** 93,96 ****
--- 97,101 ----
/// <returns>a result object returned by the action, or <code>null</code>
/// </returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
object Execute(IHibernateCallback action);
***************
*** 104,108 ****
/// </remarks>
/// <param name="action">The calback object that specifies the Hibernate action.</param>
! /// <returns></returns>
IList ExecuteFind(IHibernateCallback action);
--- 109,115 ----
/// </remarks>
/// <param name="action">The calback object that specifies the Hibernate action.</param>
! /// <returns>A IList returned by the action, or null
! /// </returns>
! /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList ExecuteFind(IHibernateCallback action);
***************
*** 113,117 ****
/// <param name="queryString">a query expressed in Hibernate's query language</param>
/// <returns>a List containing 0 or more persistent instances</returns>
! IList Find(string queryString);
--- 120,125 ----
/// <param name="queryString">a query expressed in Hibernate's query language</param>
/// <returns>a List containing 0 or more persistent instances</returns>
! /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
! IList Find(string queryString);
***************
*** 123,126 ****
--- 131,135 ----
/// <param name="value">the value of the parameter</param>
/// <returns>a List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList Find(string queryString, object value);
***************
*** 133,136 ****
--- 142,146 ----
/// <param name="type">Hibernate type of the parameter (or <code>null</code>)</param>
/// <returns>a List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList Find(string queryString, object value, IType type);
***************
*** 143,146 ****
--- 153,157 ----
/// <param name="values">the values of the parameters</param>
/// <returns>a List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList Find(string queryString, object[] values);
***************
*** 155,158 ****
--- 166,171 ----
/// <param name="types">Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>a List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
+ /// <exception cref="ArgumentException">If values and types are not null and their lengths are not equal</exception>
IList Find(string queryString, object[] values, IType[] types);
***************
*** 166,169 ****
--- 179,183 ----
/// <param name="value">The value of the parameter</param>
/// <returns>a List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedParam(string queryName, string paramName, object value);
***************
*** 177,180 ****
--- 191,195 ----
/// <param name="type">Hibernate type of the parameter (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedParam(string queryName, string paramName, object value, IType type);
***************
*** 187,190 ****
--- 202,206 ----
/// <param name="values">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedParam(string queryString, string[] paramNames, object[] values);
***************
*** 199,202 ****
--- 215,221 ----
/// <param name="types">Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
+ /// <exception cref="ArgumentOutOfRangeException">If paramNames length is not equal to values length or
+ /// if paramNames length is not equal to types length (when types is not null)</exception>
IList FindByNamedParam(string queryString, string[] paramNames, object[] values, IType[] types);
***************
*** 207,210 ****
--- 226,230 ----
/// <param name="queryName">The name of a Hibernate query in a mapping file</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedQuery(string queryName);
***************
*** 217,220 ****
--- 237,241 ----
/// <param name="value">The value of the parameter</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedQuery(string queryName, object value);
***************
*** 228,231 ****
--- 249,253 ----
/// <param name="type">Hibernate type of the parameter (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedQuery(string queryName, object value, IType type);
***************
*** 239,242 ****
--- 261,265 ----
/// <param name="values">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedQuery(string queryName, object[] values);
***************
*** 251,254 ****
--- 274,279 ----
/// <param name="types">Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
+ /// <exception cref="ArgumentOutOfRangeException">If values and types are not null and their lengths differ.</exception>
IList FindByNamedQuery(string queryName, object[] values, IType[] types);
***************
*** 262,265 ****
--- 287,291 ----
/// <param name="value">The value of the parameter</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedQueryAndNamedParam(string queryName, string paramName, object value);
***************
*** 274,277 ****
--- 300,304 ----
/// <param name="type">The Hibernate type of the parameter (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedQueryAndNamedParam(string queryName, string paramName, object value, IType type);
***************
*** 285,288 ****
--- 312,316 ----
/// <param name="values">The values of the parameters.</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedQueryAndNamedParam(string queryName, string[] paramNames, object[] values);
***************
*** 298,301 ****
--- 326,332 ----
/// <param name="types">Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
+ /// <exception cref="ArgumentOutOfRangeException">If paramNames length is not equal to values length or
+ /// if paramNames length is not equal to types length (when types is not null)</exception>
IList FindByNamedQueryAndNamedParam(string queryName, string[] paramNames, object[] values, IType[] types);
***************
*** 309,312 ****
--- 340,344 ----
/// <param name="valueObject">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByNamedQueryAndValueObject(string queryName, object valueObject);
***************
*** 318,329 ****
/// <param name="valueObject">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
IList FindByValueObject(string queryString, object valueObject);
#endregion
-
-
-
-
#region Convenience methods for loading individual objects
--- 350,358 ----
/// <param name="valueObject">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByValueObject(string queryString, object valueObject);
#endregion
#region Convenience methods for loading individual objects
***************
*** 334,338 ****
/// <param name="entityType">a persistent type.</param>
/// <param name="id">An identifier of the persistent instance.</param>
! /// <returns>The persistent instance, or <code>null</code> if not found</returns>
object Get(Type entityType, object id);
--- 363,368 ----
/// <param name="entityType">a persistent type.</param>
/// <param name="id">An identifier of the persistent instance.</param>
! /// <returns>the persistent instance, or null if not found</returns>
! /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
object Get(Type entityType, object id);
***************
*** 346,349 ****
--- 376,381 ----
/// <param name="lockMode">The lock mode.</param>
/// the persistent instance, or <code>null</code> if not found
+ /// <returns>the persistent instance, or null if not found</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
object Get(Type entityType, object id, LockMode lockMode);
***************
*** 355,358 ****
--- 387,392 ----
/// <param name="id">An identifier of the persistent instance.</param>
/// <returns>The persistent instance</returns>
+ /// <exception cref="ObjectRetrievalFailureException">If not found</exception>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
object Load(Type entityType, object id);
***************
*** 366,369 ****
--- 400,405 ----
/// <param name="lockMode">The lock mode.</param>
/// <returns>The persistent instance</returns>
+ /// <exception cref="ObjectRetrievalFailureException">If not found</exception>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
object Load(Type entityType, object id, LockMode lockMode);
***************
*** 376,379 ****
--- 412,416 ----
/// <param name="entityType">Type of the entity.</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList LoadAll(Type entityType);
***************
*** 386,395 ****
#region Convenience methods for storing individual objects
-
-
-
-
-
-
/// <summary>
/// Save or update all given persistent instances,
--- 423,426 ----
***************
*** 398,405 ****
/// <param name="entities">Tthe persistent instances to save or update
/// (to be associated with the Hibernate Session)he entities.</param>
void SaveOrUpdateAll(ICollection entities);
-
#endregion
--- 429,436 ----
/// <param name="entities">Tthe persistent instances to save or update
/// (to be associated with the Hibernate Session)he entities.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void SaveOrUpdateAll(ICollection entities);
#endregion
Index: SessionFactoryUtils.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/SessionFactoryUtils.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SessionFactoryUtils.cs 29 Jul 2007 19:39:36 -0000 1.2
--- SessionFactoryUtils.cs 19 Sep 2007 22:58:22 -0000 1.3
***************
*** 103,106 ****
--- 103,107 ----
/// <param name="interceptor">The Hibernate entity interceptor, or <code>null</code> if none.</param>
/// <returns>The new session.</returns>
+ /// <exception cref="DataAccessResourceFailureException">If could not open Hibernate session</exception>
public static ISession GetNewSession(ISessionFactory sessionFactory, IInterceptor interceptor)
{
***************
*** 409,449 ****
/// </summary>
/// <param name="ex">The Hibernate exception that occured.</param>
! /// <returns></returns>
! public static DataAccessException ConvertHibernateAccessException(HibernateException ex)
! {
! if (ex is ADOException) {
! // ADOException during Hibernate access: only passed in here from custom code,
! // as HibernateTemplate etc will use AdoExceptionTranslator-based handling.
! return new HibernateAdoException("Ado Exception", (ADOException) ex);
! }
! if (ex is UnresolvableObjectException) {
! return new HibernateObjectRetrievalFailureException((UnresolvableObjectException) ex);
! }
! if (ex is ObjectNotFoundException) {
! return new HibernateObjectRetrievalFailureException((ObjectNotFoundException) ex);
! }
! if (ex is ObjectDeletedException) {
! return new HibernateObjectRetrievalFailureException((ObjectDeletedException) ex);
! }
! if (ex is WrongClassException) {
! return new HibernateObjectRetrievalFailureException((WrongClassException) ex);
! }
! if (ex is StaleObjectStateException) {
! return new HibernateOptimisticLockingFailureException((StaleObjectStateException) ex);
! }
! if (ex is QueryException) {
! return new HibernateQueryException((QueryException) ex);
! }
!
! if (ex is PersistentObjectException) {
! return new InvalidDataAccessApiUsageException(ex.Message, ex);
! }
! if (ex is TransientObjectException) {
! return new InvalidDataAccessApiUsageException(ex.Message, ex);
! }
!
! // fallback
! return new HibernateSystemException(ex);
! }
/// <summary>
--- 410,459 ----
/// </summary>
/// <param name="ex">The Hibernate exception that occured.</param>
! /// <returns>DataAccessException instance</returns>
! public static DataAccessException ConvertHibernateAccessException(HibernateException ex)
! {
! if (ex is ADOException)
! {
! // ADOException during Hibernate access: only passed in here from custom code,
! // as HibernateTemplate etc will use AdoExceptionTranslator-based handling.
! return new HibernateAdoException("Ado Exception", (ADOException) ex);
! }
! if (ex is UnresolvableObjectException)
! {
! return new HibernateObjectRetrievalFailureException((UnresolvableObjectException) ex);
! }
! if (ex is ObjectNotFoundException)
! {
! return new HibernateObjectRetrievalFailureException((ObjectNotFoundException) ex);
! }
! if (ex is ObjectDeletedException)
! {
! return new HibernateObjectRetrievalFailureException((ObjectDeletedException) ex);
! }
! if (ex is WrongClassException)
! {
! return new HibernateObjectRetrievalFailureException((WrongClassException) ex);
! }
! if (ex is StaleObjectStateException)
! {
! return new HibernateOptimisticLockingFailureException((StaleObjectStateException) ex);
! }
! if (ex is QueryException)
! {
! return new HibernateQueryException((QueryException) ex);
! }
!
! if (ex is PersistentObjectException)
! {
! return new InvalidDataAccessApiUsageException(ex.Message, ex);
! }
! if (ex is TransientObjectException)
! {
! return new InvalidDataAccessApiUsageException(ex.Message, ex);
! }
!
! // fallback
! return new HibernateSystemException(ex);
! }
/// <summary>
***************
*** 519,522 ****
--- 529,533 ----
/// <c>true</c> if [is deferred close active] [the specified session factory]; otherwise, <c>false</c>.
/// </returns>
+ /// <exception cref="ArgumentNullException">If SessionFactory argument is null.</exception>
public static bool IsDeferredCloseActive(ISessionFactory sessionFactory)
{
***************
*** 534,537 ****
--- 545,549 ----
/// </summary>
/// <param name="sessionFactory">The session factory.</param>
+ /// <exception cref="InvalidOperationException">If there is no session factory associated with the thread.</exception>
public static void ProcessDeferredClose(ISessionFactory sessionFactory)
{
***************
*** 567,570 ****
--- 579,583 ----
/// <param name="sessionFactory">Hibernate SessionFactory that the Criteria was created for
/// (can be <code>null</code>).</param>
+ /// <exception cref="ArgumentNullException">If criteria argument is null.</exception>
public static void ApplyTransactionTimeout(ICriteria criteria, ISessionFactory sessionFactory)
{
***************
*** 589,592 ****
--- 602,606 ----
/// <param name="sessionFactory">Hibernate SessionFactory that the Query was created for
/// (can be <code>null</code>).</param>
+ /// <exception cref="ArgumentNullException">If query argument is null.</exception>
public static void ApplyTransactionTimeout(IQuery query, ISessionFactory sessionFactory)
{
***************
*** 614,617 ****
--- 628,633 ----
/// <param name="sessionFactory">The session factory.</param>
/// <returns>The corresponding IDbProvider, null if no mapping was found.</returns>
+ /// <exception cref="InvalidOperationException">If DbProviderFactory's ApplicaitonContext is not
+ /// an instance of IConfigurableApplicaitonContext.</exception>
public static IDbProvider GetDbProvider(ISessionFactory sessionFactory)
{
Index: HibernateTransactionManager.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTransactionManager.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** HibernateTransactionManager.cs 30 Aug 2007 19:59:44 -0000 1.4
--- HibernateTransactionManager.cs 19 Sep 2007 22:58:22 -0000 1.5
***************
*** 135,138 ****
--- 135,139 ----
/// to avoid repeated configuration and guarantee consistent behavior in transactions.
/// </remarks>
+ /// <exception cref="InvalidOperationException">If object factory is null and need to get entity interceptor via object name.</exception>
public IInterceptor EntityInterceptor
{
***************
*** 858,862 ****
/// </p>
/// </remarks>
! /// <exception cref="System.Exception">
/// In the event of misconfiguration (such as the failure to set a
/// required property) or if initialization fails.
--- 859,863 ----
/// </p>
/// </remarks>
! /// <exception cref="System.ArgumentException">
/// In the event of misconfiguration (such as the failure to set a
/// required property) or if initialization fails.
Index: HibernateTemplate.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTemplate.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HibernateTemplate.cs 31 May 2007 20:25:13 -0000 1.1
--- HibernateTemplate.cs 19 Sep 2007 22:58:22 -0000 1.2
***************
*** 224,227 ****
--- 224,228 ----
/// </remarks>
/// <value>The interceptor.</value>
+ /// <exception cref="InvalidOperationException">If object factory is not set and need to retrieve entity interceptor by name.</exception>
public override IInterceptor EntityInterceptor
{
***************
*** 344,347 ****
--- 345,349 ----
/// </p>
/// </remarks>
+ /// <value>The name of the entity interceptor in the object factory/application context.</value>
public override string EntityInterceptorObjectName
{
***************
*** 355,358 ****
--- 357,361 ----
/// Set the object factory instance.
/// </summary>
+ /// <value>The object factory instance</value>
public override IObjectFactory ObjectFactory
{
***************
*** 457,460 ****
--- 460,464 ----
/// to rely on auto-flushing at transaction completion.
/// </remarks>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Flush()
{
***************
*** 475,478 ****
--- 479,483 ----
/// <param name="id">An identifier of the persistent instance.</param>
/// <returns>The persistent instance, or <code>null</code> if not found</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public object Get(Type entityType, object id)
{
***************
*** 489,492 ****
--- 494,499 ----
/// <param name="lockMode">The lock mode.</param>
/// the persistent instance, or <code>null</code> if not found
+ /// <returns>the persistent instance, or null if not found</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public object Get(Type type, object id, LockMode lockMode)
{
***************
*** 502,505 ****
--- 509,514 ----
/// <param name="id">An identifier of the persistent instance.</param>
/// <returns>The persistent instance</returns>
+ /// <exception cref="ObjectRetrievalFailureException">If not found</exception>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public object Load(Type entityType, object id)
{
***************
*** 516,519 ****
--- 525,530 ----
/// <param name="lockMode">The lock mode.</param>
/// <returns>The persistent instance</returns>
+ /// <exception cref="ObjectRetrievalFailureException">If not found</exception>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public object Load(Type entityType, object id, LockMode lockMode)
{
***************
*** 528,531 ****
--- 539,544 ----
/// <param name="entity">Entity the object (of the target class) to load into.</param>
/// <param name="id">An identifier of the persistent instance.</param>
+ /// <exception cref="ObjectRetrievalFailureException">If object not found.</exception>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Load(object entity, object id)
{
***************
*** 539,542 ****
--- 552,556 ----
/// <param name="entityType">Type of the entity.</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList LoadAll(Type entityType)
{
***************
*** 548,551 ****
--- 562,566 ----
/// </summary>
/// <param name="entity">The persistent instance to re-read.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Refresh(object entity)
{
***************
*** 559,562 ****
--- 574,578 ----
/// <param name="entity">The persistent instance to re-read.</param>
/// <param name="lockMode">The lock mode to obtain.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Refresh(object entity, LockMode lockMode)
{
***************
*** 571,574 ****
--- 587,592 ----
/// <param name="entity">The he persistent instance to lock.</param>
/// <param name="lockMode">The lock mode to obtain.</param>
+ /// <exception cref="ObjectOptimisticLockingFailureException">If not found</exception>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Lock(object entity, LockMode lockMode)
{
***************
*** 581,584 ****
--- 599,603 ----
/// <param name="entity">The transient instance to persist.</param>
/// <returns>The generated identifier.</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public object Save(object entity)
{
***************
*** 591,594 ****
--- 610,614 ----
/// <param name="entity">The transient instance to persist.</param>
/// <param name="id">The identifier to assign.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Save(object entity, object id)
{
***************
*** 600,603 ****
--- 620,624 ----
/// </summary>
/// <param name="entity">The persistent instance to update.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Update(object entity)
{
***************
*** 613,616 ****
--- 634,638 ----
/// <param name="entity">The persistent instance to update.</param>
/// <param name="lockMode">The lock mode to obtain.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Update(object entity, LockMode lockMode)
{
***************
*** 624,627 ****
--- 646,650 ----
/// <param name="entity">Tthe persistent instance to save or update
/// (to be associated with the Hibernate Session).</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void SaveOrUpdate(object entity)
{
***************
*** 635,638 ****
--- 658,662 ----
/// <param name="entities">Tthe persistent instances to save or update
/// (to be associated with the Hibernate Session)he entities.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void SaveOrUpdateAll(ICollection entities)
{
***************
*** 651,654 ****
--- 675,679 ----
/// <returns>The actually associated persistent object.
/// (either an already loaded instance with the same id, or the given object)</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public object SaveOrUpdateCopy(object entity)
{
***************
*** 675,678 ****
--- 700,704 ----
/// <c>true</c> if session cache contains the specified entity; otherwise, <c>false</c>.
/// </returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public bool Contains(object entity)
{
***************
*** 684,687 ****
--- 710,714 ----
/// </summary>
/// <param name="entity">The persistent instance to evict.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Evict(object entity)
{
***************
*** 691,698 ****
--- 718,727 ----
+
/// <summary>
/// Delete the given persistent instance.
/// </summary>
/// <param name="entity">The persistent instance to delete.</param>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Delete(object entity)
{
***************
*** 700,706 ****
--- 729,738 ----
}
+
/// <summary>
/// Delete the given persistent instance.
/// </summary>
+ /// <param name="entity">Tthe persistent instance to delete.</param>
+ /// <param name="lockMode">The lock mode to obtain.</param>
/// <remarks>
/// Obtains the specified lock mode if the instance exists, implicitly
***************
*** 708,713 ****
/// (throwing an OptimisticLockingFailureException if not found).
/// </remarks>
! /// <param name="entity">Tthe persistent instance to delete.</param>
! /// <param name="lockMode">The lock mode to obtain.</param>
public void Delete(object entity, LockMode lockMode)
{
--- 740,744 ----
/// (throwing an OptimisticLockingFailureException if not found).
/// </remarks>
! /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void Delete(object entity, LockMode lockMode)
{
***************
*** 720,723 ****
--- 751,755 ----
/// <param name="queryString">a query expressed in Hibernate's query language.</param>
/// <returns>The number of entity instances deleted.</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public int Delete(string queryString)
{
***************
*** 732,735 ****
--- 764,768 ----
/// <param name="type">The Hibernate type of the parameter (or <code>null</code>).</param>
/// <returns>The number of entity instances deleted.</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public int Delete(string queryString, object value, IType type)
{
***************
*** 744,747 ****
--- 777,782 ----
/// <param name="types"> Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>The number of entity instances deleted.</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
+ /// <exception cref="ArgumentOutOfRangeException">If length for argument values and types are not equal.</exception>
public int Delete(String queryString, Object[] values, IType[] types)
{
***************
*** 754,765 ****
}
/// <summary>
/// Delete all given persistent instances.
/// </summary>
/// <remarks>
/// This can be combined with any of the find methods to delete by query
/// in two lines of code, similar to Session's delete by query methods.
/// </remarks>
! /// <param name="entities">The persistent instances to delete.</param>
public void DeleteAll(ICollection entities)
{
--- 789,802 ----
}
+
/// <summary>
/// Delete all given persistent instances.
/// </summary>
+ /// <param name="entities">The persistent instances to delete.</param>
/// <remarks>
/// This can be combined with any of the find methods to delete by query
/// in two lines of code, similar to Session's delete by query methods.
/// </remarks>
! /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public void DeleteAll(ICollection entities)
{
***************
*** 785,788 ****
--- 822,826 ----
/// <returns>a result object returned by the action, or <code>null</code>
/// </returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public object Execute(HibernateDelegate del)
{
***************
*** 822,825 ****
--- 860,864 ----
/// </p>
/// </remarks>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public object Execute(IHibernateCallback action)
{
***************
*** 835,839 ****
/// </remarks>
/// <param name="action">The calback object that specifies the Hibernate action.</param>
! /// <returns></returns>
public IList ExecuteFind(IHibernateCallback action)
{
--- 874,880 ----
/// </remarks>
/// <param name="action">The calback object that specifies the Hibernate action.</param>
! /// <returns>A IList returned by the action, or null
! /// </returns>
! /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList ExecuteFind(IHibernateCallback action)
{
***************
*** 936,939 ****
--- 977,981 ----
/// a List containing 0 or more persistent instances
/// </returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList Find(string queryString)
{
***************
*** 950,953 ****
--- 992,996 ----
/// a List containing 0 or more persistent instances
/// </returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList Find(string queryString, object value)
{
***************
*** 965,968 ****
--- 1008,1012 ----
/// a List containing 0 or more persistent instances
/// </returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList Find(string queryString, object value, IType type)
{
***************
*** 977,980 ****
--- 1021,1025 ----
/// <param name="values">the values of the parameters</param>
/// <returns>a List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList Find(string queryString, object[] values)
{
***************
*** 992,995 ****
--- 1037,1042 ----
/// a List containing 0 or more persistent instances
/// </returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
+ /// <exception cref="ArgumentException">If values and types are not null and their lengths are not equal</exception>
public IList Find(string queryString, object[] values, IType[] types)
{
***************
*** 1009,1012 ****
--- 1056,1060 ----
/// <param name="value">The value of the parameter</param>
/// <returns>a List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedParam(string queryName, string paramName, object value)
{
***************
*** 1023,1026 ****
--- 1071,1075 ----
/// <param name="type">Hibernate type of the parameter (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedParam(string queryName, string paramName, object value, IType type)
{
***************
*** 1036,1039 ****
--- 1085,1089 ----
/// <param name="values">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedParam(string queryString, string[] paramNames, object[] values)
{
***************
*** 1050,1053 ****
--- 1100,1106 ----
/// <param name="types">Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
+ /// <exception cref="ArgumentOutOfRangeException">If paramNames length is not equal to values length or
+ /// if paramNames length is not equal to types length (when types is not null)</exception>
public IList FindByNamedParam(string queryString, string[] paramNames, object[] values, IType[] types)
{
***************
*** 1061,1065 ****
}
! return (IList)Execute(new FindByNamedParamHibernateCallback(this, queryString, paramNames, values, types),true);
}
--- 1114,1118 ----
}
! return (IList)Execute(new FindByNamedParamHibernateCallback(this, queryString, paramNames, values, types),true);
}
***************
*** 1071,1074 ****
--- 1124,1128 ----
/// <param name="queryName">The name of a Hibernate query in a mapping file</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedQuery(string queryName)
{
***************
*** 1084,1087 ****
--- 1138,1142 ----
/// <param name="value">The value of the parameter</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedQuery(string queryName, object value)
{
***************
*** 1098,1101 ****
--- 1153,1157 ----
/// <param name="type">Hibernate type of the parameter (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedQuery(string queryName, object value, IType type)
{
***************
*** 1111,1114 ****
--- 1167,1171 ----
/// <param name="values">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedQuery(string queryName, object[] values)
{
***************
*** 1125,1128 ****
--- 1182,1187 ----
/// <param name="types">Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
+ /// <exception cref="ArgumentOutOfRangeException">If values and types are not null and their lengths differ.</exception>
public IList FindByNamedQuery(string queryName, object[] values, IType[] types)
{
***************
*** 1145,1148 ****
--- 1204,1208 ----
/// <param name="value">The value of the parameter</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedQueryAndNamedParam(string queryName, string paramName, object value)
{
***************
*** 1177,1180 ****
--- 1237,1241 ----
/// <param name="values">The values of the parameters.</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedQueryAndNamedParam(string queryName, string[] paramNames, object[] values)
{
***************
*** 1193,1196 ****
--- 1254,1260 ----
/// <param name="types">Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
+ /// <exception cref="ArgumentOutOfRangeException">If paramNames length is not equal to values length or
+ /// if paramNames length is not equal to types length (when types is not null)</exception>
public IList FindByNamedQueryAndNamedParam(string queryName, string[] paramNames, object[] values, IType[] types)
{
***************
*** 1199,1203 ****
throw new ArgumentOutOfRangeException("paramNames","Length of paramNames array must match length of values array");
}
! if (values != null && types != null && paramNames.Length != types.Length)
{
throw new ArgumentOutOfRangeException("paramNams","Length of paramNames array must match length of types array");
--- 1263,1267 ----
throw new ArgumentOutOfRangeException("paramNames","Length of paramNames array must match length of values array");
}
! if (paramNames != null && types != null && paramNames.Length != types.Length)
{
throw new ArgumentOutOfRangeException("paramNams","Length of paramNames array must match length of types array");
***************
*** 1215,1218 ****
--- 1279,1283 ----
/// <param name="valueObject">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByNamedQueryAndValueObject(string queryName, object valueObject)
{
***************
*** 1228,1235 ****
/// <param name="valueObject">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
public IList FindByValueObject(string queryString, object valueObject)
{
return (IList)Execute(new FindByValueObjectHibernateCallback(this, queryString, valueObject), true);
-
}
--- 1293,1300 ----
/// <param name="valueObject">The values of the parameters</param>
/// <returns>A List containing 0 or more persistent instances</returns>
+ /// <exception cref="DataAccessException">In case of Hibernate errors</exception>
public IList FindByValueObject(string queryString, object valueObject)
{
return (IList)Execute(new FindByValueObjectHibernateCallback(this, queryString, valueObject), true);
}
***************
*** 1244,1247 ****
--- 1309,1313 ----
/// </summary>
/// <param name="session">The session.</param>
+ /// <returns>The session proxy.</returns>
public virtual ISession CreateSessionProxy(ISession session)
{
***************
*** 1272,1275 ****
--- 1338,1343 ----
/// </remarks>
/// <param name="session">The current Hibernate session.</param>
+ /// <exception cref="InvalidDataAccessApiUsageException">If write operation is attempted in read-only mode
+ /// </exception>
public virtual void CheckWriteOperationAllowed(ISession session)
{
***************
*** 1504,1508 ****
IQuery queryObject = session.CreateQuery(queryString);
outer.PrepareQuery(queryObject);
-
if (values != null)
{
--- 1572,1575 ----
|