コード例 #1
0
		private void InitializeEntitiesAndCollections( IList hydratedObjects, object resultSetId, ISessionImplementor session )
		{
			if( Persisters.Length > 0 )
			{
				int hydratedObjectsSize = hydratedObjects.Count;

				if( log.IsDebugEnabled )
				{
					log.Debug( string.Format( "total objects hydrated: {0}", hydratedObjectsSize ) );
				}

				for( int i = 0; i < hydratedObjectsSize; i++ )
				{
					session.InitializeEntity( hydratedObjects[ i ] );
				}
			}

			ICollectionPersister collectionPersister = CollectionPersister;
			if( collectionPersister != null )
			{
				//this is a query and we are loading multiple instances of the same collection role
				session.EndLoadingCollections( collectionPersister, resultSetId );
			}
		}
コード例 #2
0
		public object Load(object id, object optionalObject, LockMode lockMode, ISessionImplementor session)
		{
			Custom clone = null;
			Custom obj = (Custom) Instances[id];
			if(obj!=null) 
			{
				clone = (Custom)obj.Clone();
				session.AddUninitializedEntity( new Key(id, this), clone, LockMode.None );
				session.PostHydrate( this, id, new string[] {obj.Name}, clone, LockMode.None );
				session.InitializeEntity(clone);
			}
			return clone;

		}
コード例 #3
0
		internal void InitializeEntitiesAndCollections(
			IList hydratedObjects,
			object resultSetId,
			ISessionImplementor session)
		{
			ICollectionPersister[] collectionPersisters = CollectionPersisters;
			if (collectionPersisters != null)
			{
				for (int i = 0; i < collectionPersisters.Length; i++)
				{
					if (collectionPersisters[i].IsArray)
					{
						//for arrays, we should end the collection load before resolving
						//the entities, since the actual array instances are not instantiated
						//during loading
						//TODO: or we could do this polymorphically, and have two
						//      different operations implemented differently for arrays
						EndCollectionLoad(resultSetId, session, collectionPersisters[i]);
					}
				}
			}

			if (hydratedObjects != null)
			{
				int hydratedObjectsSize = hydratedObjects.Count;

				if (log.IsDebugEnabled)
				{
					log.Debug(string.Format("total objects hydrated: {0}", hydratedObjectsSize));
				}

				for (int i = 0; i < hydratedObjectsSize; i++)
				{
					session.InitializeEntity(hydratedObjects[i]);
				}
			}

			if (collectionPersisters != null)
			{
				for (int i = 0; i < collectionPersisters.Length; i++)
				{
					if (!collectionPersisters[i].IsArray)
					{
						//for sets, we should end the collection load after resolving
						//the entities, since we might call hashCode() on the elements
						//TODO: or we could do this polymorphically, and have two
						//      different operations implemented differently for arrays
						EndCollectionLoad(resultSetId, session, collectionPersisters[i]);
					}
				}
			}
		}