public void addTablesToJoin(ObjectStack stack)
	{
		// add the actual representation
		ObjectRepresentation actual = stack.getActualRepresentation();
		this.joinRepresentations.add(actual);
		if (actual.isArray())
		{
			addTableToJoin(NameGenerator.getArrayTablename(adapter), actual.getAsName());
		}
		else
		{
			addTableToJoin(actual.getTableName(), actual.getAsName());
		}
		if (addJoins)
		{
			// if we should, add all others
			List<ObjectRepresentation> allReps = stack.getAllRepresentations();
			for (ObjectRepresentation rep : allReps)
			{
				if (!rep.equals(actual))
				{
					this.joinRepresentations.add(rep);
					if (rep.isArray())
					{
						addTableToJoin(NameGenerator.getArrayTablename(adapter),
								rep.getAsName());
					}
					else
					{
						addTableToJoin(rep.getTableName(), rep.getAsName());
					}
				}
			}
		}
	}