private void RegisterNonExists(
			Key[ ] keys,
			int[ ] owners,
			ILoadable[ ] persisters,
			ISessionImplementor session
			)
		{
			for( int i = 0; i < keys.Length; i++ )
			{
				int owner = owners[ i ];
				if( owner > -1 )
				{
					Key ownerKey = keys[ owner ];
					if( keys[ i ] == null && ownerKey != null )
					{
						session.AddNonExist( new Key( ownerKey.Identifier, persisters[ i ] ) );
					}
				}
			}
		}
Example #2
0
		/// <summary>
		/// For missing objects associated by one-to-one with another object in the
		/// result set, register the fact that the the object is missing with the
		/// session.
		/// </summary>
		private void RegisterNonExists(
			EntityKey[] keys,
			ILoadable[] persisters,
			ISessionImplementor session
			)
		{
			int[] owners = Owners;
			if (owners != null)
			{
				EntityType[] ownerAssociationTypes = OwnerAssociationTypes;
				for (int i = 0; i < keys.Length; i++)
				{
					int owner = owners[i];
					if (owner > -1)
					{
						EntityKey ownerKey = keys[owner];
						if (keys[i] == null && ownerKey != null)
						{
							bool isOneToOneAssociation = ownerAssociationTypes != null &&
								ownerAssociationTypes[i] != null &&
								ownerAssociationTypes[i].IsOneToOne;

							if (isOneToOneAssociation)
							{
								// Added to fix NH-687, not in Hibernate:
								bool isUniqueKeyReference = ownerAssociationTypes != null &&
								                            ownerAssociationTypes[i] != null &&
								                            ownerAssociationTypes[i].IsUniqueKeyReference;
								if (!isUniqueKeyReference)
								{
									session.AddNonExist(new EntityKey(ownerKey.Identifier, persisters[i]));
								}
							}
						}
					}
				}
			}
		}