Example #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);
            }
        }
Example #2
0
        private void WalkCompositeComponentIdTree(IOuterJoinLoadable persister, string alias, string path)
        {
            IType  type         = persister.IdentifierType;
            string propertyName = persister.IdentifierPropertyName;

            if (type != null && type.IsComponentType)
            {
                ILhsAssociationTypeSqlInfo associationTypeSQLInfo = JoinHelper.GetIdLhsSqlInfo(alias, persister, Factory);
                WalkComponentTree((IAbstractComponentType)type, 0, alias, SubPath(path, propertyName), 0, associationTypeSQLInfo);
            }
        }
Example #3
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);
        }
Example #4
0
        /// <summary>
        /// For an entity class, add to a list of associations to be fetched
        /// by outerjoin
        /// </summary>
        protected virtual void WalkEntityTree(IOuterJoinLoadable persister, string alias, string path, int currentDepth)
        {
            int n = persister.CountSubclassProperties();

            for (int i = 0; i < n; i++)
            {
                IType type = persister.GetSubclassPropertyType(i);
                ILhsAssociationTypeSqlInfo associationTypeSQLInfo = JoinHelper.GetLhsSqlInfo(alias, i, persister, Factory);
                if (type.IsAssociationType)
                {
                    WalkEntityAssociationTree((IAssociationType)type, persister, i, alias, path,
                                              persister.IsSubclassPropertyNullable(i), currentDepth, associationTypeSQLInfo);
                }
                else if (type.IsComponentType)
                {
                    WalkComponentTree((IAbstractComponentType)type, 0, alias, SubPath(path, persister.GetSubclassPropertyName(i)),
                                      currentDepth, associationTypeSQLInfo);
                }
            }
        }
Example #5
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);
			}
		}
Example #6
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);
		}