From: Paul H. <pha...@us...> - 2005-03-06 12:45:35
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate/Engine Modified Files: Cascades.cs ISessionFactoryImplementor.cs ISessionImplementor.cs Key.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: ISessionImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ISessionImplementor.cs 1 Mar 2005 16:24:46 -0000 1.30 --- ISessionImplementor.cs 6 Mar 2005 12:44:39 -0000 1.31 *************** *** 41,44 **** --- 41,45 ---- /// that the client is modifying it /// </summary> + /// TODO: (2.1) This method no longer required. void Dirty( PersistentCollection collection ); *************** *** 133,142 **** object ImmediateLoad( System.Type persistentClass, object id ); ! // /// <summary> ! // /// Load an instance immediately. Do not return a proxy ! // /// </summary> ! // /// <param name="persistentClass"></param> ! // /// <param name="id"></param> ! // /// <returns></returns> /// <summary> --- 134,145 ---- object ImmediateLoad( System.Type persistentClass, object id ); ! /// <summary> ! /// Load an instance by a unique key that is not the primary key. ! /// </summary> ! /// <param name="persistentClass"></param> ! /// <param name="uniqueKeyPropertyName"></param> ! /// <param name="id"></param> ! /// <returns></returns> ! object LoadByUniqueKey( System.Type persistentClass, string uniqueKeyPropertyName, object id ); /// <summary> *************** *** 152,156 **** ISessionFactoryImplementor Factory { get; } - /// <summary> /// Get the prepared statement <c>Batcher</c> for this session --- 155,158 ---- *************** *** 334,337 **** --- 336,396 ---- ICollection GetOrphans( PersistentCollection coll ); + /// <summary> + /// Get a batch of uninitialized collection keys for this role + /// </summary> + /// <param name="collectionPersister"></param> + /// <param name="id"></param> + /// <param name="batchSize"></param> + /// <returns></returns> + object[] GetCollectionBatch( ICollectionPersister collectionPersister, object id, int batchSize ); + + /// <summary> + /// Get a batch of unloaded identifiers for this class + /// </summary> + /// <param name="clazz"></param> + /// <param name="id"></param> + /// <param name="batchSize"></param> + /// <returns></returns> + object[] GetClassBatch( System.Type clazz, object id, int batchSize ); + + /// <summary> + /// Register the entity as batch loadable, if enabled + /// </summary> + /// <param name="clazz"></param> + /// <param name="id"></param> + void ScheduleBatchLoad( System.Type clazz, object id ); + + /// <summary> + /// Execute an SQL Query + /// </summary> + /// <param name="sqlQuery"></param> + /// <param name="aliases"></param> + /// <param name="classes"></param> + /// <param name="queryParameters"></param> + /// <param name="querySpaces"></param> + /// <returns></returns> + IList FindBySQL( string sqlQuery, string[] aliases, System.Type[] classes, QueryParameters queryParameters, ICollection querySpaces ); + + /// <summary> + /// new in 2.1 no javadoc + /// </summary> + /// <param name="key"></param> + void AddNonExist( Key key ); + + /// <summary> + /// new in 2.1 no javadoc + /// </summary> + /// <param name="obj"></param> + /// <param name="copiedAlready"></param> + /// <returns></returns> + object Copy( object obj, IDictionary copiedAlready ); + + /// <summary> + /// new in 2.1 no javadoc + /// </summary> + /// <param name="key"></param> + /// <param name="collectionPersister"></param> + /// <returns></returns> + object GetCollectionOwner( object key, ICollectionPersister collectionPersister ); } } \ No newline at end of file Index: ISessionFactoryImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionFactoryImplementor.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ISessionFactoryImplementor.cs 1 Mar 2005 16:24:46 -0000 1.14 --- ISessionFactoryImplementor.cs 6 Mar 2005 12:44:39 -0000 1.15 *************** *** 15,31 **** { /// <summary> - /// TODO: determine if this is more appropriate for ISessionFactory - /// </summary> - IConnectionProvider ConnectionProvider { get; } - - /// <summary> - /// Gets the IsolationLevel an IDbTransaction should be set to. - /// </summary> - /// <remarks> - /// This is only applicable to manually controlled NHibernate Transactions. - /// </remarks> - IsolationLevel Isolation { get; } - - /// <summary> /// Get the persister for a class /// </summary> --- 15,18 ---- *************** *** 59,63 **** /// Is outerjoin fetching enabled? /// </summary> ! bool EnableJoinedFetch { get; } /// <summary> --- 46,60 ---- /// Is outerjoin fetching enabled? /// </summary> ! bool IsOuterJoinedFetchEnabled { get; } ! ! /// <summary> ! /// Are scrollable <tt>ResultSet</tt>s supported? ! /// </summary> ! bool IsScrollableResultSetsEnabled { get; } ! ! /// <summary> ! /// Get the database schema specified in <tt>hibernate.default_schema</tt> ! /// </summary> ! bool IsGetGeneratedKeysEnabled { get; } /// <summary> *************** *** 72,81 **** /// <summary> - /// Gets a boolean indicating if the sql statement should be prepared. The value - /// is read from <c>hibernate.prepare_sql</c>. - /// </summary> - bool PrepareSql { get; } - - /// <summary> /// Get the return types of a query /// </summary> --- 69,72 ---- *************** *** 85,88 **** --- 76,113 ---- /// <summary> + /// TODO: determine if this is more appropriate for ISessionFactory + /// </summary> + IConnectionProvider ConnectionProvider { get; } + + /// <summary> + /// Get the names of all persistent classes that implement/extend the given interface/class + /// </summary> + /// <param name="clazz"></param> + /// <returns></returns> + string[ ] GetImplementors( System.Type clazz ); + + /// <summary> + /// Get a class name, using query language imports + /// </summary> + /// <param name="name"></param> + /// <returns></returns> + string GetImportedClassName( string name ); + + /// <summary> + /// + /// </summary> + int BatchSize { get; } + + /// <summary> + /// + /// </summary> + int FetchSize { get; } + + /// <summary> + /// + /// </summary> + int MaximumFetchDepth { get; } + + /// <summary> /// Get the named parameter names for a query /// </summary> *************** *** 104,119 **** /// <summary> ! /// Get the names of all persistent classes that implement/extend the given interface/class /// </summary> ! /// <param name="clazz"></param> ! /// <returns></returns> ! string[ ] GetImplementors( System.Type clazz ); /// <summary> ! /// Get a class name, using query language imports /// </summary> ! /// <param name="name"></param> ! /// <returns></returns> ! string GetImportedClassName( string name ); } } \ No newline at end of file --- 129,145 ---- /// <summary> ! /// Gets the IsolationLevel an IDbTransaction should be set to. /// </summary> ! /// <remarks> ! /// This is only applicable to manually controlled NHibernate Transactions. ! /// </remarks> ! IsolationLevel Isolation { get; } ! /// <summary> ! /// Gets a boolean indicating if the sql statement should be prepared. The value ! /// is read from <c>hibernate.prepare_sql</c>. /// </summary> ! bool PrepareSql { get; } } } \ No newline at end of file Index: Cascades.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/Cascades.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Cascades.cs 1 Mar 2005 16:24:45 -0000 1.16 --- Cascades.cs 6 Mar 2005 12:44:38 -0000 1.17 *************** *** 101,105 **** return true; } - } --- 101,104 ---- *************** *** 124,128 **** return false; } - } --- 123,126 ---- *************** *** 162,167 **** public override bool ShouldCascadeCollection( object collection ) { - return CollectionIsInitialized( collection ); // saves/updates don't cascade to uninitialized collections } --- 160,165 ---- public override bool ShouldCascadeCollection( object collection ) { // saves/updates don't cascade to uninitialized collections + return CollectionIsInitialized( collection ); } *************** *** 170,174 **** --- 168,195 ---- return true; } + } + + /// <summary></summary> + public static CascadingAction ActionReplicate = new ActionReplicateClass(); + private class ActionReplicateClass : CascadingAction + { + public override void Cascade( ISessionImplementor session, object child, object anything ) + { + log.Debug( "cascading to Replicate()" ); + // TODO: 2.1 implement replication + //session.Replicate( child, (ReplicationMode) anything ); + } + + public override bool ShouldCascadeCollection( object collection ) + { + // replicate does cascade to uninitialized collections + return true; + } + + public override bool DeleteOrphans() + { + return false; // I suppose? + } } Index: Key.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/Key.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Key.cs 31 Dec 2004 17:36:40 -0000 1.8 --- Key.cs 6 Mar 2005 12:44:39 -0000 1.9 *************** *** 11,18 **** public sealed class Key { ! private object id; ! private object identifierSpace; ! private Key( object id, object identifierSpace ) { if( id == null ) --- 11,20 ---- public sealed class Key { ! private readonly object identifier; ! private readonly object identifierSpace; ! private readonly System.Type clazz; ! private readonly bool isBatchLoadable; ! private Key( object id, object identifierSpace, System.Type clazz, bool isBatchLoadable ) { if( id == null ) *************** *** 20,25 **** throw new ArgumentException( "null identifier", "id" ); } ! this.id = id; this.identifierSpace = identifierSpace; } --- 22,29 ---- throw new ArgumentException( "null identifier", "id" ); } ! this.identifier = id; this.identifierSpace = identifierSpace; + this.clazz = clazz; + this.isBatchLoadable = isBatchLoadable; } *************** *** 29,33 **** /// <param name="id"></param> /// <param name="p"></param> ! public Key( object id, IClassPersister p ) : this( id, p.IdentifierSpace ) { } --- 33,37 ---- /// <param name="id"></param> /// <param name="p"></param> ! public Key( object id, IClassPersister p ) : this( id, p.IdentifierSpace, p.MappedClass, p.IsBatchLoadable ) { } *************** *** 38,42 **** public object Identifier { ! get { return id; } } --- 42,62 ---- public object Identifier { ! get { return identifier; } ! } ! ! /// <summary> ! /// ! /// </summary> ! public System.Type MappedClass ! { ! get { return clazz; } ! } ! ! /// <summary> ! /// ! /// </summary> ! public bool IsBatchLoadable ! { ! get { return isBatchLoadable; } } *************** *** 53,57 **** return false; } ! return otherKey.identifierSpace.Equals( this.identifierSpace ) && otherKey.id.Equals( this.id ); } --- 73,77 ---- return false; } ! return otherKey.identifierSpace.Equals( this.identifierSpace ) && otherKey.Identifier.Equals( this.identifier ); } *************** *** 59,63 **** public override int GetHashCode() { ! return id.GetHashCode(); } --- 79,86 ---- public override int GetHashCode() { ! int result = 17; ! result = 37 * result + identifierSpace.GetHashCode(); ! result = 37 * result + identifier.GetHashCode(); ! return result; } *************** *** 65,69 **** public override string ToString() { ! return id.ToString(); } --- 88,92 ---- public override string ToString() { ! return identifier.ToString(); } |