public List<ColumnDetail> getDetailsOfColumns(String tableName) throws MainException {

		try {
			DatabaseMetaData dbMetadata = dbConnection.getMetaData();
			ResultSet results = dbMetadata.getColumns(null, null, tableName, null);

			List<ColumnDetail> columns = new ArrayList<ColumnDetail>();
			List<String> uniqueCols    = getUniqueColumns(tableName);
			CachedRowSet foreignKeys   = getForeignKeys(tableName);
			Map<String,Map<String,String>> foreignKeyToRefTableAndCol = new HashMap<String,Map<String,String>>();

			// process foreign keys according to the foreign keys of the table
			while (foreignKeys.next()) {
				String fkColumnName = foreignKeys.getString("FKCOLUMN_NAME");
				String pkColumnName = foreignKeys.getString("PKCOLUMN_NAME");
				String pkTableName  = foreignKeys.getString("PKTABLE_NAME");
				Map<String,String> refTableToCol = new HashMap<String,String>();
				refTableToCol.put(pkTableName, pkColumnName);
				foreignKeyToRefTableAndCol.put(fkColumnName, refTableToCol);
			}

			// process the columns of the table
			while (results.next()) {
				String colName      = results.getString("COLUMN_NAME");
				boolean colNullable = results.getInt("NULLABLE") == DatabaseMetaData.columnNullable ? true : false;
				boolean colUnique   = uniqueCols.contains(colName);
				int colSize         = results.getInt("COLUMN_SIZE");
				int colSQLType      = results.getInt("DATA_TYPE");
				String colDefault   = results.getString("COLUMN_DEF");
				Map<String,String> refTableToCol = foreignKeyToRefTableAndCol.get(colName);
				ColumnDetail column = new ColumnDetail(tableName, colName, refTableToCol, colDefault, colNullable, colUnique, colSize, colSQLType);
				columns.add(column);
			}

			return columns;

		} catch (SQLException e) {
			e.printStackTrace();
			throw new MainException("Exception when retrieving detail of columns for table " + tableName + " : " + e.getMessage());
		}
	}