示例#1
0
        public static Ejb3Column[] BuildColumnFromAnnotation(
            ColumnAttribute[] anns,
            FormulaAttribute formulaAnn, Nullability nullability, IPropertyHolder propertyHolder,
            IPropertyData inferredData,
            IDictionary <string, Join> secondaryTables,
            ExtendedMappings mappings)
        {
            Ejb3Column[] columns;

            if (formulaAnn != null)
            {
                Ejb3Column formulaColumn = new Ejb3Column();
                formulaColumn.SetFormula(formulaAnn.Value);
                formulaColumn.SetImplicit(false);
                formulaColumn.Mappings       = mappings;
                formulaColumn.PropertyHolder = propertyHolder;
                formulaColumn.Bind();
                columns = new Ejb3Column[] { formulaColumn };
            }
            else
            {
                columns = BuildColumnFromAnnotation(anns,
                                                    nullability,
                                                    propertyHolder,
                                                    inferredData,
                                                    secondaryTables,
                                                    mappings);
            }
            return(columns);
        }
示例#2
0
        private static Ejb3Column[] BuildImplicitColumn(IPropertyData inferredData,
                                                        IDictionary <string, Join> secondaryTables,
                                                        IPropertyHolder propertyHolder, Nullability nullability,
                                                        ExtendedMappings mappings)
        {
            Ejb3Column[] columns;
            columns = new Ejb3Column[1];
            Ejb3Column column = new Ejb3Column();

            column.SetImplicit(false);
            //not following the spec but more clean
            if (nullability != Nullability.ForcedNull && inferredData.ClassOrElement.IsPrimitive &&
                !inferredData.Property.GetType().IsArray)         //TODO: IsArray in this way ???
            {
                column.SetNullable(false);
            }
            column.SetLength(DEFAULT_COLUMN_LENGTH);
            column.PropertyName   = BinderHelper.GetRelativePath(propertyHolder, inferredData.PropertyName);
            column.PropertyHolder = propertyHolder;
            column.SetJoins(secondaryTables);
            column.Mappings = mappings;
            column.Bind();
            columns[0] = column;
            return(columns);
        }
示例#3
0
 public IndexOrUniqueKeySecondPass(string indexName, Ejb3Column column, ExtendedMappings mappings, bool unique)
 {
     this.indexName = indexName;
     this.column    = column;
     columns        = null;
     this.mappings  = mappings;
     this.unique    = unique;
 }
		public IndexOrUniqueKeySecondPass(string indexName, Ejb3Column column, ExtendedMappings mappings, bool unique)
		{
			this.indexName = indexName;
			this.column = column;
			columns = null;
			this.mappings = mappings;
			this.unique = unique;
		}
		public static Table FillTable(string schema, string catalog, string realTableName, string logicalName,
		                              bool? isAbstract,
		                              IList<string[]> uniqueConstraints,
		                              string constraints,
		                              Table denormalizedSuperTable,
		                              ExtendedMappings mappings)
		{
			throw new NotImplementedException();
		}
		public static void BindFk(PersistentClass referencedEntity,
		                          PersistentClass destinationEntity,
		                          Ejb3JoinColumn[] columns,
		                          SimpleValue value,
		                          bool unique,
		                          ExtendedMappings mappings)
		{
			throw new NotImplementedException();
		}
示例#7
0
 public IndexOrUniqueKeySecondPass(Table table, string indexName, string[] columns, ExtendedMappings mappings)
 {
     this.table     = table;
     this.indexName = indexName;
     this.columns   = columns;
     this.mappings  = mappings;
     column         = null;
     unique         = false;
 }
		public IndexOrUniqueKeySecondPass(Table table, string indexName, string[] columns, ExtendedMappings mappings)
		{
			this.table = table;
			this.indexName = indexName;
			this.columns = columns;
			this.mappings = mappings;
			column = null;
			unique = false;
		}
		public static Ejb3JoinColumn BuildJoinColumn(PrimaryKeyJoinColumnAttribute pkJoinAnn,
									JoinColumnAttribute joinAnn, 
									IKeyValue identifier,
									IDictionary<string, Join> joins, 
									IPropertyHolder propertyHolder, 
									ExtendedMappings mappings)
		{
			throw new NotImplementedException();
		}
		public EntityBinder(
			EntityAttribute hibAnn,
			System.Type annotatedClass,
			PersistentClass persistentClass,
			ExtendedMappings mappings
			)
		{
			this.mappings = mappings;
			this.persistentClass = persistentClass;
			this.annotatedClass = annotatedClass;
			BindHibernateAnnotation(hibAnn);
		}
		public ToOneFkSecondPass(ToOne value,
		                         Ejb3JoinColumn[] columns,
		                         bool unique,
		                         string entityClassName,
		                         string path,
		                         ExtendedMappings mappings) : base(value, columns)
		{
			this.mappings = mappings;
			this.unique = unique;
			this.entityClassName = entityClassName;
			this.path = entityClassName != null ? path.Substring(entityClassName.Length + 1) : path;
		}
示例#12
0
 public ToOneFkSecondPass(ToOne value,
                          Ejb3JoinColumn[] columns,
                          bool unique,
                          string entityClassName,
                          string path,
                          ExtendedMappings mappings) : base(value, columns)
 {
     this.mappings        = mappings;
     this.unique          = unique;
     this.entityClassName = entityClassName;
     this.path            = entityClassName != null?path.Substring(entityClassName.Length + 1) : path;
 }
示例#13
0
        private static Ejb3Column[] BuildColumnFromAnnotation(ColumnAttribute[] anns, Nullability nullability,
                                                              IPropertyHolder propertyHolder, IPropertyData inferredData,
                                                              IDictionary <string, Join> secondaryTables,
                                                              ExtendedMappings mappings)
        {
            ColumnAttribute[] actualCols     = anns;
            ColumnAttribute[] overriddenCols = propertyHolder.GetOverriddenColumn(StringHelper.Qualify(propertyHolder.Path, inferredData.PropertyName));

            if (overriddenCols != null)
            {
                //check for overridden first
                if (anns != null && overriddenCols.Length != anns.Length)
                {
                    throw new AnnotationException("AttributeOverride.column() should override all columns for now");
                }

                actualCols = overriddenCols.Length == 0 ? null : overriddenCols;
                log.DebugFormat("Column(s) overridden for property {0}", inferredData.PropertyName);
            }

            if (actualCols == null)
            {
                return(BuildImplicitColumn(inferredData, secondaryTables, propertyHolder, nullability, mappings));
            }

            int length = actualCols.Length;

            Ejb3Column[] columns = new Ejb3Column[length];
            for (int index = 0; index < length; index++)
            {
                ColumnAttribute col     = actualCols[index];
                String          sqlType = col.ColumnDefinition.Equals("") ? null : col.ColumnDefinition;
                Ejb3Column      column  = new Ejb3Column();
                column.SetImplicit(false);
                column.SetSqlType(sqlType);
                column.SetLength(col.Length);
                column.SetPrecision(col.Precision);
                column.SetScale(col.Scale);
                column.SetLogicalColumnName(col.Name);
                column.PropertyName = BinderHelper.GetRelativePath(propertyHolder, inferredData.PropertyName);
                column.SetNullable(col.Nullable); //TODO force to not null if available? This is a (bad) user choice.
                column.SetUnique(col.Unique);
                column.SetInsertable(col.Insertable);
                column.SetUpdatable(col.Updatable);
                column.SetSecondaryTableName(col.Table);
                column.PropertyHolder = propertyHolder;
                column.SetJoins(secondaryTables);
                column.Mappings = mappings;
                column.Bind();
                columns[index] = column;
            }
            return(columns);
        }
	    public static void BindDefaults(ExtendedMappings mappings)
	    {
	        throw new NotImplementedException();
	    }
		public IndexOrUniqueKeySecondPass(string indexName, Ejb3Column column, ExtendedMappings mappings)
			: this(indexName, column, mappings, false)
		{
		}
示例#16
0
 public IndexOrUniqueKeySecondPass(string indexName, Ejb3Column column, ExtendedMappings mappings)
     : this(indexName, column, mappings, false)
 {
 }
示例#17
0
        public static Ejb3Column[] BuildColumnFromAnnotation(
            ColumnAttribute[] anns,
            FormulaAttribute formulaAnn, Nullability nullability, IPropertyHolder propertyHolder,
            IPropertyData inferredData,
            IDictionary<string, Join> secondaryTables,
            ExtendedMappings mappings)
        {
            Ejb3Column[] columns;

            if (formulaAnn != null)
            {
                Ejb3Column formulaColumn = new Ejb3Column();
                formulaColumn.SetFormula(formulaAnn.Value);
                formulaColumn.SetImplicit(false);
                formulaColumn.Mappings = mappings;
                formulaColumn.PropertyHolder = propertyHolder;
                formulaColumn.Bind();
                columns = new Ejb3Column[] {formulaColumn};
            }
            else
            {
                columns = BuildColumnFromAnnotation(anns,
                                                    nullability,
                                                    propertyHolder,
                                                    inferredData,
                                                    secondaryTables,
                                                    mappings);
            }
            return columns;
        }
示例#18
0
 private static Ejb3Column[] BuildImplicitColumn(IPropertyData inferredData,
                                                 IDictionary<string, Join> secondaryTables,
                                                 IPropertyHolder propertyHolder, Nullability nullability,
                                                 ExtendedMappings mappings)
 {
     Ejb3Column[] columns;
     columns = new Ejb3Column[1];
     Ejb3Column column = new Ejb3Column();
     column.SetImplicit(false);
     //not following the spec but more clean
     if (nullability != Nullability.ForcedNull  && inferredData.ClassOrElement.IsPrimitive
             && !inferredData.Property.GetType().IsArray ) //TODO: IsArray in this way ???
     {
         column.SetNullable(false);
     }
     column.SetLength(DEFAULT_COLUMN_LENGTH);
     column.PropertyName = BinderHelper.GetRelativePath(propertyHolder, inferredData.PropertyName);
     column.PropertyHolder = propertyHolder;
     column.SetJoins(secondaryTables);
     column.Mappings = mappings;
     column.Bind();
     columns[0] = column;
     return columns;
 }
示例#19
0
        private static Ejb3Column[] BuildColumnFromAnnotation(ColumnAttribute[] anns, Nullability nullability,
                                                              IPropertyHolder propertyHolder, IPropertyData inferredData,
                                                              IDictionary<string, Join> secondaryTables,
                                                              ExtendedMappings mappings)
        {
            ColumnAttribute[] actualCols = anns;
            ColumnAttribute[] overriddenCols = propertyHolder.GetOverriddenColumn(StringHelper.Qualify(propertyHolder.Path, inferredData.PropertyName));

            if (overriddenCols != null)
            {
                //check for overridden first
                if (anns != null && overriddenCols.Length != anns.Length)
                    throw new AnnotationException("AttributeOverride.column() should override all columns for now");

                actualCols = overriddenCols.Length == 0 ? null : overriddenCols;
                log.DebugFormat("Column(s) overridden for property {0}", inferredData.PropertyName);
            }

            if (actualCols == null)
                return BuildImplicitColumn(inferredData, secondaryTables, propertyHolder, nullability, mappings);

            int length = actualCols.Length;
            Ejb3Column[] columns = new Ejb3Column[length];
            for (int index = 0; index < length; index++)
            {
                ColumnAttribute col = actualCols[index];
                String sqlType = col.ColumnDefinition.Equals("") ? null : col.ColumnDefinition;
                Ejb3Column column = new Ejb3Column();
                column.SetImplicit(false);
                column.SetSqlType(sqlType);
                column.SetLength(col.Length);
                column.SetPrecision(col.Precision);
                column.SetScale(col.Scale);
                column.SetLogicalColumnName(col.Name);
                column.PropertyName = BinderHelper.GetRelativePath(propertyHolder, inferredData.PropertyName);
                column.SetNullable(col.Nullable); //TODO force to not null if available? This is a (bad) user choice.
                column.SetUnique(col.Unique);
                column.SetInsertable(col.Insertable);
                column.SetUpdatable(col.Updatable);
                column.SetSecondaryTableName(col.Table);
                column.PropertyHolder = propertyHolder;
                column.SetJoins(secondaryTables);
                column.Mappings = mappings;
                column.Bind();
                columns[index] = column;
            }
            return columns;
        }
 	public static void CreateSyntheticPropertyReference(Ejb3JoinColumn[] columns, PersistentClass @ref, object o, ManyToOne one, bool b, ExtendedMappings mappings)
 	{
 		throw new System.NotImplementedException();
 	}
		public void SetMappings(ExtendedMappings mappings)
		{
			this.mappings = mappings;
		}
示例#22
0
 public static void BindDefaults(ExtendedMappings mappings)
 {
     throw new NotImplementedException();
 }