public Join AddJoin(JoinTableAttribute joinTableAnn, bool noDelayInPkColumnCreation)
 {
     Join join = entityBinder.AddJoin(joinTableAnn, this, noDelayInPkColumnCreation);
     joins = entityBinder.SecondaryTables;
     return join;
 }
		//public void FirstLevelSecondaryTablesBinding(SecondaryTable secTable, SecondaryTables secTables) 
		//{
		//    if (secTables != null) 
		//    {
		//        //loop through it
		//        for (SecondaryTable tab : secTables.value()) 
		//        {
		//            addJoin( tab, null, null, false );
		//        }
		//    }
		//    else 
		//    {
		//        if ( secTable != null ) addJoin( secTable, null, null, false );
		//    }
		//}

		/// <summary>
		/// Used for @*ToMany @JoinTable
		/// </summary>
		public Join AddJoin(JoinTableAttribute joinTable, IPropertyHolder holder, bool noDelayInPkColumnCreation)
		{
			return AddJoin(null, joinTable, holder, noDelayInPkColumnCreation);
		}
		/// <summary>
		/// A non null propertyHolder means than we process the Pk creation without delay
		/// </summary>
		/// <param name="secondaryTable"></param>
		/// <param name="joinTable"></param>
		/// <param name="propertyHolder"></param>
		/// <param name="noDelayInPkColumnCreation"></param>
		/// <returns></returns>
		private Join AddJoin(SecondaryTableAttribute secondaryTable,
			JoinTableAttribute joinTable,
			IPropertyHolder propertyHolder,
			bool noDelayInPkColumnCreation)
		{
			Join join = new Join();
			join.PersistentClass = persistentClass;
			string schema;
			string catalog;
			string table;
			string realTable;

			System.Persistence.UniqueConstraintAttribute[] uniqueConstraintsAnn;
			if (secondaryTable != null)
			{
				schema = secondaryTable.Schema;
				catalog = secondaryTable.Catalog;
				table = secondaryTable.Name;
				realTable = mappings.NamingStrategy.TableName(table); //always an explicit table name
				uniqueConstraintsAnn = secondaryTable.UniqueConstraints;
			}
			else if (joinTable != null)
			{
				schema = joinTable.Schema;
				catalog = joinTable.Catalog;
				table = joinTable.Name;
				realTable = mappings.NamingStrategy.TableName(table); //always an explicit table name
				uniqueConstraintsAnn = joinTable.UniqueConstraints;
			}
			else
			{
				throw new AssertionFailure("Both JoinTable and SecondaryTable are null");
			}

			var uniqueConstraints = new List<string[]>(uniqueConstraintsAnn == null ? 0 : uniqueConstraintsAnn.Length);
			if (uniqueConstraintsAnn != null && uniqueConstraintsAnn.Length != 0)
			{
				foreach (UniqueConstraintAttribute uc in uniqueConstraintsAnn)
				{
					uniqueConstraints.Add(uc.ColumnNames);
				}
			}
			Table tableMapping = TableBinder.FillTable(
					schema,
					catalog,
					realTable,
					table, false, uniqueConstraints, null, null, mappings);
			//no check constraints available on joins
			join.Table = tableMapping;

			//somehow keep joins() for later.
			//Has to do the work later because it needs persistentClass id!
			object joinColumns = null;
			//get the appropriate pk columns
			if (secondaryTable != null)
			{
				joinColumns = secondaryTable.PkJoinColumns;
			}
			else if (joinTable != null)
			{
				joinColumns = joinTable.JoinColumns;
			}
			log.InfoFormat("Adding secondary table to entity {0} -> {1}", persistentClass.EntityName, join.Table.Name);

			TableAttribute matchingTable = FindMatchingComplimentTableAnnotation(join);

			if (matchingTable != null)
			{
				join.IsSequentialSelect = FetchMode.Join != matchingTable.Fetch;
				join.IsInverse = matchingTable.IsInverse;
				join.IsOptional = matchingTable.IsOptional;
				if (!BinderHelper.IsDefault(matchingTable.SqlInsert.Sql))
				{
					join.SetCustomSQLInsert(matchingTable.SqlInsert.Sql.Trim(),
							matchingTable.SqlInsert.Callable,
							ExecuteUpdateResultCheckStyle.Parse(matchingTable.SqlInsert.Check.ToString().ToLower()));
				}
				if (!BinderHelper.IsDefault(matchingTable.SqlUpdate.Sql))
				{
					join.SetCustomSQLUpdate(matchingTable.SqlUpdate.Sql.Trim(),
							matchingTable.SqlUpdate.Callable,
							ExecuteUpdateResultCheckStyle.Parse(matchingTable.SqlUpdate.Check.ToString().ToLower())
					);
				}
				if (!BinderHelper.IsDefault(matchingTable.SqlDelete.Sql))
				{
					join.SetCustomSQLDelete(matchingTable.SqlDelete.Sql.Trim(),
							matchingTable.SqlDelete.Callable,
							ExecuteUpdateResultCheckStyle.Parse(matchingTable.SqlDelete.Check.ToString().ToLower())
					);
				}
			}
			else
			{
				//default
				join.IsSequentialSelect = false;
				join.IsInverse = false;
				join.IsOptional = false; //perhaps not quite per-spec, but a Good Thing anyway
			}

			if (noDelayInPkColumnCreation)
			{
				CreatePrimaryColumnsToSecondaryTable(joinColumns, propertyHolder, join);
			}
			else
			{
				secondaryTables.Add(table, join);
				secondaryTableJoins.Add(table, joinColumns);
			}
			return join;
		}
		public Join AddJoin(JoinTableAttribute joinTableAnn, bool noDelayInPkColumnCreation)
		{
			throw new System.NotImplementedException();
		}