Exemple #1
0
        /// <summary>
        /// For a component, add to a list of associations to be fetched by outerjoin
        /// </summary>
        protected void WalkComponentTree(IAbstractComponentType componentType, int begin, string alias, string path,
                                         int currentDepth, ILhsAssociationTypeSqlInfo associationTypeSQLInfo)
        {
            IType[]  types         = componentType.Subtypes;
            string[] propertyNames = componentType.PropertyNames;
            for (int i = 0; i < types.Length; i++)
            {
                if (types[i].IsAssociationType)
                {
                    var associationType = (IAssociationType)types[i];

                    string[] aliasedLhsColumns = associationTypeSQLInfo.GetAliasedColumnNames(associationType, begin);
                    string[] lhsColumns        = associationTypeSQLInfo.GetColumnNames(associationType, begin);
                    string   lhsTable          = associationTypeSQLInfo.GetTableName(associationType);

                    string subpath             = SubPath(path, propertyNames[i]);
                    bool[] propertyNullability = componentType.PropertyNullability;

                    JoinType joinType = GetJoinType(associationType, componentType.GetFetchMode(i), subpath, lhsTable, lhsColumns,
                                                    propertyNullability == null || propertyNullability[i], currentDepth,
                                                    componentType.GetCascadeStyle(i));

                    AddAssociationToJoinTreeIfNecessary(associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType);
                }
                else if (types[i].IsComponentType)
                {
                    string subpath = SubPath(path, propertyNames[i]);

                    WalkComponentTree((IAbstractComponentType)types[i], begin, alias, subpath, currentDepth, associationTypeSQLInfo);
                }
                begin += types[i].GetColumnSpan(Factory);
            }
        }
Exemple #2
0
        private void WalkEntityAssociationTree(IAssociationType associationType, IOuterJoinLoadable persister,
                                               int propertyNumber, string alias, string path, bool nullable, int currentDepth,
                                               ILhsAssociationTypeSqlInfo associationTypeSQLInfo)
        {
            string[] aliasedLhsColumns = associationTypeSQLInfo.GetAliasedColumnNames(associationType, 0);
            string[] lhsColumns        = associationTypeSQLInfo.GetColumnNames(associationType, 0);
            string   lhsTable          = associationTypeSQLInfo.GetTableName(associationType);

            string subpath = SubPath(path, persister.GetSubclassPropertyName(propertyNumber));

            JoinType joinType = GetJoinType(associationType, persister.GetFetchMode(propertyNumber), subpath, lhsTable,
                                            lhsColumns, nullable, currentDepth, persister.GetCascadeStyle(propertyNumber));

            AddAssociationToJoinTreeIfNecessary(associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType);
        }
		/// <summary>
		/// For a component, add to a list of associations to be fetched by outerjoin
		/// </summary>
		protected void WalkComponentTree(IAbstractComponentType componentType, int begin, string alias, string path,
		                                 int currentDepth, ILhsAssociationTypeSqlInfo associationTypeSQLInfo)
		{
			IType[] types = componentType.Subtypes;
			string[] propertyNames = componentType.PropertyNames;
			for (int i = 0; i < types.Length; i++)
			{
				if (types[i].IsAssociationType)
				{
					var associationType = (IAssociationType) types[i];

					string[] aliasedLhsColumns = associationTypeSQLInfo.GetAliasedColumnNames(associationType, begin);
					string[] lhsColumns = associationTypeSQLInfo.GetColumnNames(associationType, begin);
					string lhsTable = associationTypeSQLInfo.GetTableName(associationType);

					string subpath = SubPath(path, propertyNames[i]);
					bool[] propertyNullability = componentType.PropertyNullability;

					JoinType joinType = GetJoinType(associationType, componentType.GetFetchMode(i), subpath, lhsTable, lhsColumns,
					                                propertyNullability == null || propertyNullability[i], currentDepth,
					                                componentType.GetCascadeStyle(i));

					AddAssociationToJoinTreeIfNecessary(associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType);
				}
				else if (types[i].IsComponentType)
				{
					string subpath = SubPath(path, propertyNames[i]);

					WalkComponentTree((IAbstractComponentType) types[i], begin, alias, subpath, currentDepth, associationTypeSQLInfo);
				}
				begin += types[i].GetColumnSpan(Factory);
			}
		}
		private void WalkEntityAssociationTree(IAssociationType associationType, IOuterJoinLoadable persister,
		                                       int propertyNumber, string alias, string path, bool nullable, int currentDepth,
		                                       ILhsAssociationTypeSqlInfo associationTypeSQLInfo)
		{
			string[] aliasedLhsColumns = associationTypeSQLInfo.GetAliasedColumnNames(associationType, 0);
			string[] lhsColumns = associationTypeSQLInfo.GetColumnNames(associationType, 0);
			string lhsTable = associationTypeSQLInfo.GetTableName(associationType);

			string subpath = SubPath(path, persister.GetSubclassPropertyName(propertyNumber));

			JoinType joinType = GetJoinType(associationType, persister.GetFetchMode(propertyNumber), subpath, lhsTable,
			                                lhsColumns, nullable, currentDepth, persister.GetCascadeStyle(propertyNumber));

			AddAssociationToJoinTreeIfNecessary(associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType);
		}