SELECT句生成

@param metadata エンティティメタ情報
@param type エイティティタイプ
@param sqlIdKeyName SQL_IDキー名
@return SELECT句
332711
protected String buildSelectClause(final TableMetadata metadata, final Class<? extends Object> type,
			final String sqlIdKeyName) {
		final List<? extends TableMetadata.Column> columns = metadata.getColumns();

		final StringBuilder sql = new StringBuilder("SELECT ").append("/* ").append(sqlIdKeyName).append(" */")
				.append(System.lineSeparator());

		boolean firstFlag = true;
		for (final TableMetadata.Column col : columns) {
			sql.append("\t");
			if (firstFlag) {
				sql.append("  ");
				firstFlag = false;
			} else {
				sql.append(", ");
			}
			sql.append(col.getColumnIdentifier()).append("\tAS\t").append(col.getColumnIdentifier());
			if (StringUtils.isNotEmpty(col.getRemarks())) {
				sql.append("\t").append("-- ").append(col.getRemarks());
			}
			sql.append(System.lineSeparator());
		}
		sql.append("FROM ").append(metadata.getTableIdentifier()).append(System.lineSeparator());

		return sql.toString();
	}
205258
@Override
    public void setGeneratedColumnInfo(int generate, ResultMetaData meta) {

        // can support INSERT_SELECT also
        if (type != StatementTypes.INSERT) {
            return;
        }

        int colIndex = baseTable.getIdentityColumnIndex();

        if (colIndex == -1) {
            return;
        }

        switch (generate) {

            case ResultConstants.RETURN_NO_GENERATED_KEYS :
                return;

            case ResultConstants.RETURN_GENERATED_KEYS_COL_INDEXES :
                int[] columnIndexes = meta.getGeneratedColumnIndexes();

                if (columnIndexes.length != 1) {
                    return;
                }

                if (columnIndexes[0] != colIndex) {
                    return;
                }

            // $FALL-THROUGH$
            case ResultConstants.RETURN_GENERATED_KEYS :
                generatedIndexes = new int[]{ colIndex };
                break;

            case ResultConstants.RETURN_GENERATED_KEYS_COL_NAMES :
                String[] columnNames = meta.getGeneratedColumnNames();

                if (columnNames.length != 1) {
                    return;
                }

                if (baseTable.findColumn(columnNames[0]) != colIndex) {
                    return;
                }

                generatedIndexes = new int[]{ colIndex };
                break;
        }

        generatedResultMetaData =
            ResultMetaData.newResultMetaData(generatedIndexes.length);

        for (int i = 0; i < generatedIndexes.length; i++) {
            ColumnSchema column = baseTable.getColumn(generatedIndexes[i]);

            generatedResultMetaData.columns[i] = column;
        }

        generatedResultMetaData.prepareData();
    }
679985
public static void generateSelect(Builder builder, SQLiteModelMethod method) throws ClassNotFoundException {
		SelectType selectResultType = SelectBuilderUtility.detectSelectType(method);

		// generate select method
		selectResultType.generate(builder, method);

		if (method.hasLiveData()) {
			// generate
			selectResultType.generateLiveData(builder, method);
		}

		if (method.contentProviderEntryPathEnabled) {
			// we need to generate UPDATE or DELETE for content provider to
			generateSelectForContentProvider(builder, method, selectResultType);
		}
	}
281832
public static void generateSQL(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) {
		JQLChecker jqlChecker = JQLChecker.getInstance();

		methodBuilder.addCode("\n// generate sql\n");
		String sql = jqlChecker.replace(method, method.jql, new JQLReplacerListenerImpl(method) {
			@Override
			public String onColumnNameToUpdate(String columnName) {
				// only entity's columns
				return currentEntity.findPropertyByName(columnName).columnName;
			}

			@Override
			public String onColumnName(String columnName) {
				return currentSchema.findColumnNameByPropertyName(method, columnName);
			}

			@Override
			public String onBindParameter(String bindParameterName, boolean inStatement) {
				return "?";
			}

		});

		if (method.jql.dynamicReplace.containsKey(JQLDynamicStatementType.DYNAMIC_WHERE)) {
			methodBuilder.addStatement("String _sql=String.format($S, $L)",
					sql.replace(method.jql.dynamicReplace.get(JQLDynamicStatementType.DYNAMIC_WHERE), "%s"),
					"StringUtils.ifNotEmptyAppend(_sqlDynamicWhere,\" AND \")");
		} else {
			methodBuilder.addStatement("String _sql=$S", sql);
		}
	}
1110904
private static String createTypeId(Type type) {
        if (type instanceof Class<?>)
            return Class.class.cast(type).getName();

        if (type instanceof ParameterizedType)
            return createTypeId(((ParameterizedType) type).getRawType())
                + Stream.of(((ParameterizedType) type).getActualTypeArguments())
                .map(CdiSpiHelper::createTypeId)
                .collect(joining(",", "<", ">"));

        if (type instanceof TypeVariable<?>)
            return TypeVariable.class.cast(type).getName();

        if (type instanceof GenericArrayType)
            return createTypeId(GenericArrayType.class.cast(type).getGenericComponentType());

        throw new UnsupportedOperationException("Unable to create type id for type [" + type + "]");
    }
185063
public static RDBMetadata createMetadata(Connection conn,
											 TypeFactory typeFactory,
											 JdbcTypeMapper jdbcTypeMapper) throws SQLException  {

		final DatabaseMetaData md = conn.getMetaData();
		String productName = md.getDatabaseProductName();
		if (printouts) {
			System.out.println("=================================\nDBMetadataExtractor REPORT: " + productName);
			System.out.println("storesLowerCaseIdentifiers: " + md.storesLowerCaseIdentifiers());
			System.out.println("storesUpperCaseIdentifiers: " + md.storesUpperCaseIdentifiers());
			System.out.println("storesMixedCaseIdentifiers: " + md.storesMixedCaseIdentifiers());
			System.out.println("supportsMixedCaseIdentifiers: " + md.supportsMixedCaseIdentifiers());
			System.out.println("storesLowerCaseQuotedIdentifiers: " + md.storesLowerCaseQuotedIdentifiers());
			System.out.println("storesUpperCaseQuotedIdentifiers: " + md.storesUpperCaseQuotedIdentifiers());
			System.out.println("storesMixedCaseQuotedIdentifiers: " + md.storesMixedCaseQuotedIdentifiers());
			System.out.println("supportsMixedCaseQuotedIdentifiers: " + md.supportsMixedCaseQuotedIdentifiers());
			System.out.println("getIdentifierQuoteString: " + md.getIdentifierQuoteString());
		}

		QuotedIDFactory idfac;
		//  MySQL
		if (productName.contains("MySQL"))  {
			//System.out.println("getIdentifierQuoteString: " + md.getIdentifierQuoteString());
			idfac = new QuotedIDFactoryMySQL(md.storesMixedCaseIdentifiers(), "`");
		}
		else if (md.storesMixedCaseIdentifiers()) {
			// treat Exareme as a case-sensitive DB engine (like MS SQL Server)
			// "SQL Server" = MS SQL Server
			idfac = new QuotedIDFactoryIdentity("\"");
		}
		else {
			if (md.storesLowerCaseIdentifiers())
				// PostgreSQL treats unquoted identifiers as lower-case
				idfac = new QuotedIDFactoryLowerCase("\"");
			else if (md.storesUpperCaseIdentifiers())
				// Oracle, DB2, H2, HSQL
				idfac = new QuotedIDFactoryStandardSQL("\"");
			else {
				log.warn("Unknown combination of identifier handling rules: " + md.getDatabaseProductName());
				log.warn("storesLowerCaseIdentifiers: " + md.storesLowerCaseIdentifiers());
				log.warn("storesUpperCaseIdentifiers: " + md.storesUpperCaseIdentifiers());
				log.warn("storesMixedCaseIdentifiers: " + md.storesMixedCaseIdentifiers());
				log.warn("supportsMixedCaseIdentifiers: " + md.supportsMixedCaseIdentifiers());
				log.warn("storesLowerCaseQuotedIdentifiers: " + md.storesLowerCaseQuotedIdentifiers());
				log.warn("storesUpperCaseQuotedIdentifiers: " + md.storesUpperCaseQuotedIdentifiers());
				log.warn("storesMixedCaseQuotedIdentifiers: " + md.storesMixedCaseQuotedIdentifiers());
				log.warn("supportsMixedCaseQuotedIdentifiers: " + md.supportsMixedCaseQuotedIdentifiers());
				log.warn("getIdentifierQuoteString: " + md.getIdentifierQuoteString());

				idfac = new QuotedIDFactoryStandardSQL("\"");
			}
		}

		RDBMetadata metadata = new RDBMetadata(md.getDriverName(), md.getDriverVersion(),
							productName, md.getDatabaseProductVersion(), idfac, jdbcTypeMapper, typeFactory);

		return metadata;
	}
1104352
protected String buildDeleteSQL(final TableMetadata metadata, final Class<? extends Object> type,
			final SqlConfig sqlConfig, final boolean addCondition) {
		StringBuilder sql = new StringBuilder("DELETE ").append("/* ")
				.append(sqlConfig.getSqlAgentFactory().getSqlIdKeyName()).append(" */")
				.append(" FROM ").append(metadata.getTableIdentifier()).append("").append(System.lineSeparator());

		if (addCondition) {
			boolean firstFlag = true;
			sql.append("WHERE").append(System.lineSeparator());

			List<? extends Column> cols = !metadata.getKeyColumns().isEmpty() ? metadata.getKeyColumns()
					: Arrays
							.asList(metadata.getColumns().get(0));
			for (TableMetadata.Column col : cols) {
				StringBuilder parts = new StringBuilder().append("\t");
				if (firstFlag) {
					if (col.isNullable()) {
						parts.append("AND ");
					} else {
						parts.append("    ");
					}
					firstFlag = false;
				} else {
					parts.append("AND ");
				}
				parts.append(col.getColumnIdentifier()).append(" = ").append("/*").append(col.getCamelColumnName())
						.append("*/''").append(System.lineSeparator());
				if (col.isNullable()) {
					wrapIfComment(sql, parts, col);
				} else {
					sql.append(parts);
				}
			}
		}
		return sql.toString();
	}
536385
@Override
    public Object generate(TableGeneratorDiscriptor discriptor, ClientBase client, String dataType)
    {
        Cassandra.Client conn = ((CassandraClientBase) client).getRawClient(discriptor.getSchema());
        long latestCount = 0l;
        try
        {
            conn.set_keyspace(discriptor.getSchema());

            if (((CassandraClientBase) client).isCql3Enabled())
            {
                CQLTranslator translator = new CQLTranslator();
                ((CassandraClientBase) client).execute(translator.buildUpdateQuery(discriptor).toString(), conn);

                CqlResult result = ((CassandraClientBase) client).execute(translator.buildSelectQuery(discriptor)
                        .toString(), conn);

                for (CqlRow row : result.getRows())
                {
                    latestCount = ByteBufferUtil.toLong(ByteBuffer.wrap(row.getColumns().get(0).getValue()));
                }
            }
            else
            {

                ColumnPath columnPath = new ColumnPath(discriptor.getTable());
                columnPath.setColumn(discriptor.getValueColumnName().getBytes());

                try
                {
                    latestCount = conn.get(ByteBuffer.wrap(discriptor.getPkColumnValue().getBytes()), columnPath,
                            ((CassandraClientBase) client).getConsistencyLevel()).counter_column.value;
                }
                catch (NotFoundException e)
                {
                    log.warn("Counter value not found for {}, resetting it to zero.", discriptor.getPkColumnName());
                    latestCount = 0;
                }
                ColumnParent columnParent = new ColumnParent(discriptor.getTable());

                CounterColumn counterColumn = new CounterColumn(ByteBuffer.wrap(discriptor.getValueColumnName()
                        .getBytes()), 1);

                conn.add(ByteBuffer.wrap(discriptor.getPkColumnValue().getBytes()), columnParent, counterColumn,
                        ((CassandraClientBase) client).getConsistencyLevel());
            }
            if (latestCount == 0)
            {
                return (long) discriptor.getInitialValue();
            }
            else
            {
                return (latestCount + 1) * discriptor.getAllocationSize();
            }
        }
        catch (UnavailableException e)
        {
            log.error("Error while reading counter value from table{}, Caused by: .", discriptor.getTable(), e);
            throw new KunderaException(e);
        }
        catch (TimedOutException e)
        {
            log.error("Error while reading counter value from table{}, Caused by: .", discriptor.getTable(), e);
            throw new KunderaException(e);
        }
        catch (Exception e)
        {
            log.error("Error while using keyspace. Caused by: .", e);
            throw new KunderaException(e);
        }
    }
704421
public static Map<String, String> resource(String type, Map<String, String> meta) {
        HashMap<String, String> authResource = new HashMap<String, String>();
        if (null != meta) {
            authResource.putAll(meta);
        }
        authResource.put(TYPE_FIELD, type);
        return authResource;
    }
500204
public static boolean isFindKeyOnly(EntityMetadata metadata, List<Map<String, Object>> colToOutput)
    {
        if (colToOutput != null && colToOutput.size() == 1)
        {
            String idCol = ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName();
            return idCol.equals(colToOutput.get(0).get(Constants.DB_COL_NAME)) && !(boolean) colToOutput.get(0).get(Constants.IS_EMBEDDABLE);
        }
        else
        {
            return false;
        }
    }
1189547
private static JQL buildJQLSelect(final SQLiteModelMethod method, final JQL result, final Map<JQLDynamicStatementType, String> dynamicReplace, String preparedJql) {
		final Class<? extends Annotation> annotation = BindSqlSelect.class;
		final SQLiteDaoDefinition dao = method.getParent();

		if (StringUtils.hasText(preparedJql)) {
			result.value = preparedJql;

			// In SELECT SQL only where statement can contains bind parameter
			JQLChecker.getInstance().analyze(method, result, new JqlBaseListener() {

				@Override
				public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) {
					JQLDynamicStatementType dynamicType = JQLDynamicStatementType.valueOf(ctx.bind_parameter_name().getText().toUpperCase());

					int start = ctx.getStart().getStartIndex() - 1;
					int stop = ctx.getStop().getStopIndex() + 1;

					String dynamicWhere = result.value.substring(start, stop);

					dynamicReplace.put(dynamicType, dynamicWhere);
				}
			});

			JQLChecker.getInstance().replaceVariableStatements(method, preparedJql, new JQLReplaceVariableStatementListenerImpl() {

				@Override
				public String onWhere(String statement) {
					result.annotatedWhere = true;
					result.staticWhereConditions = true;
					return null;
				}

				@Override
				public String onOrderBy(String statement) {
					result.annotatedOrderBy = true;
					result.staticOrderBy = true;
					return null;
				}

				@Override
				public String onOffset(String statement) {
					result.annotatedOffset = true;
					return null;
				}

				@Override
				public String onLimit(String statement) {
					result.annotatedLimit = true;
					return null;
				}

				@Override
				public String onHaving(String statement) {
					result.annotatedHaving = true;
					return null;
				}

				@Override
				public String onGroup(String statement) {
					result.annotatedGroupBy = true;
					return null;
				}

			});

			forEachParameter(method, new OnMethodParameterListener() {

				@Override
				public void onMethodParameter(VariableElement methodParam) {
					if (methodParam.getAnnotation(BindSqlDynamicOrderBy.class) != null) {
						String orderDynamicName = methodParam.getSimpleName().toString();

						result.paramOrderBy = orderDynamicName;

						// CONSTRAINT: @BindSqlOrderBy can be used only on
						// String
						// parameter type
						AssertKripton.assertTrueOrInvalidTypeForAnnotationMethodParameterException(TypeUtility.isEquals(TypeUtility.typeName(String.class), TypeUtility.typeName(methodParam)),
								method.getParent().getElement(), method.getElement(), methodParam, BindSqlDynamicOrderBy.class);
					}

				}
			});

		} else {
			// extract some informaction from method and bean
			// use annotation's attribute value and exclude and bean definition
			// to
			// define field list
			final Set<String> fields = extractFieldsFromAnnotation(method, BindSqlSelect.class, true);

			boolean distinct = AnnotationUtility.extractAsBoolean(method.getElement(), annotation, AnnotationAttributeType.DISTINCT);
			String annotatedGroupBy = AnnotationUtility.extractAsString(method.getElement(), annotation, AnnotationAttributeType.GROUP_BY);
			String annotatedHaving = AnnotationUtility.extractAsString(method.getElement(), annotation, AnnotationAttributeType.HAVING);

			StringBuilder builder = new StringBuilder();
			builder.append(SELECT_KEYWORD + " ");

			//
			if (distinct) {
				builder.append(DISTINCT_KEYWORD + " ");
			}

			// recreate fields
			builder.append(forEachFields(fields, new OnFieldListener() {

				@Override
				public String onField(String item) {
					return item;
				}
			}));

			// entity name
			builder.append(" " + FROM_KEYWORD + " " + dao.getEntitySimplyClassName());

			// where
			builder.append(defineWhereStatement(method, result, annotation, dynamicReplace));

			// group by
			if (StringUtils.hasText(annotatedGroupBy)) {
				result.annotatedGroupBy = true;
				builder.append(" " + GROUP_BY_KEYWORD + " " + annotatedGroupBy);
			}

			// having
			if (StringUtils.hasText(annotatedHaving)) {
				result.annotatedHaving = true;
				builder.append(" " + HAVING_KEYWORD + " " + annotatedHaving);
			}

			// order by
			builder.append(defineOrderByStatement(method, result, annotation, dynamicReplace));

			// limit
			builder.append(defineLimitStatement(method, result, annotation, dynamicReplace));

			result.value = builder.toString();

		}

		result.value = JQLChecker.getInstance().replace(method, result.value, new JQLReplacerListenerImpl(method, true) {

			@Override
			public String onBindParameter(String bindParameterName, boolean inStatement) {
				if (inStatement) {
					TypeName typeName = method.findParameterType(method.findParameterNameByAlias(bindParameterName));

					AssertKripton.assertTrueOrInvalidMethodSignException(typeName != null && (TypeUtility.isArray(typeName) || TypeUtility.isCollection(typeName)), method,
							"'in' condition need an array or collection parameter");

					String dynamicSpread = bindParameterName;

					dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_SPREAD, dynamicSpread);
					result.spreadParams.add(dynamicSpread);

					// return
					// "#{"+JQLDynamicStatementType.DYNAMIC_SPREAD+"}";
					return null;
				}

				return null;
			}
		});
		
		if (method.isPagedLiveData()) {
			// if is a paged live data, it must have pagination
			dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_PAGE_OFFSET, "");
			dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_PAGE_SIZE, "");			
		}

		result.operationType = JQLType.SELECT;
		result.dynamicReplace = dynamicReplace;
		return result;
	}
1126255
private String createSqlId(final TableMetadata metadata, final Class<? extends Object> entityType) {
		return "mapping @ " + (entityType != null ? entityType.getSimpleName() : metadata.getTableName());
	}
635321
void select(String key) {
        Property hit = null;
        for (Property property : dataProvider.getList()) {
            if (property.getName().equals(key)) {
                hit = property;
                break;
            }
        }
        if (hit != null) {
            selectionModel.setSelected(hit, true);
        } else {
            table.selectDefaultEntity();
        }
    }
430214
public int createIds(String type) {

		List<String> tables = getMissing(type);

		for (String tableName : tables) {
			getOrCreate(tableName);
		}

		return tables.size();
	}
96483
public String generateJavaDoc(MethodSpec.Builder methodBuilder, final SQLiteModelMethod method, TypeName returnType) {
		final SQLiteEntity entity = method.getEntity();
		final One<Boolean> inColumnValues = new One<Boolean>(false);
		final List<Pair<String, TypeName>> methodParamsUsedAsColumnValue = new ArrayList<>();
		final List<Pair<String, TypeName>> methodParamsUsedAsParameter = new ArrayList<>();

		// transform JQL to SQL
		String sqlInsert = JQLChecker.getInstance().replace(method, method.jql, new JQLReplacerListenerImpl(method) {

			@Override
			public void onColumnValueSetBegin(Column_value_setContext ctx) {
				inColumnValues.value0 = true;
			}

			@Override
			public void onColumnValueSetEnd(Column_value_setContext ctx) {
				inColumnValues.value0 = false;
			}

			@Override
			public String onColumnName(String columnName) {
				Set<SQLProperty> property = currentSchema.getPropertyBySimpleName(columnName);
				AssertKripton.assertTrueOrUnknownPropertyInJQLException(property != null, method, columnName);

				SQLProperty tempProperty = property.iterator().next();
				AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName);

				return tempProperty.columnName;
			}

			@Override
			public String onBindParameter(String bindParameterName, boolean inStatement) {
				String resolvedParamName = method.findParameterNameByAlias(bindParameterName);

				if (inColumnValues.value0) {
					methodParamsUsedAsColumnValue.add(new Pair<>(resolvedParamName, method.findParameterType(resolvedParamName)));
				} else {
					methodParamsUsedAsParameter.add(new Pair<>(resolvedParamName, method.findParameterType(resolvedParamName)));
				}

				return SqlAnalyzer.PARAM_PREFIX + resolvedParamName + SqlAnalyzer.PARAM_SUFFIX;
			}					

		});

		methodBuilder.addJavadoc("<h2>SQL insert</h2>\n");
		methodBuilder.addJavadoc("<pre>$L</pre>\n", sqlInsert);
		methodBuilder.addJavadoc("\n");

		if (methodParamsUsedAsColumnValue.size() > 0) {
			// list of inserted fields
			methodBuilder.addJavadoc("<h2>Inserted columns:</strong></h2>\n");
			methodBuilder.addJavadoc("<dl>\n");
			for (Pair<String, TypeName> property : methodParamsUsedAsColumnValue) {
				//String resolvedName = method.findParameterAliasByName(property.value0);				
				String resolvedName=method.findParameterNameByAlias(property.value0);
				/*SQLProperty prop = entity.get(resolvedName);
								
				if (prop == null)
					throw (new PropertyNotFoundException(method, property.value0, property.value1));*/
				
				methodBuilder.addJavadoc("\t<dt>$L</dt>", property.value0);
				methodBuilder.addJavadoc("<dd>is binded to query's parameter <strong>$L</strong> and method's parameter <strong>$L</strong></dd>\n", SqlAnalyzer.PARAM_PREFIX + property.value0 + SqlAnalyzer.PARAM_SUFFIX, resolvedName);
			}
			methodBuilder.addJavadoc("</dl>\n\n");
		}

		// list of parameters
		if (methodParamsUsedAsParameter.size() > 0) {
			methodBuilder.addJavadoc("<h2>Method parameters used as sql parameters</h2>\n");
			methodBuilder.addJavadoc("<dl>\n");
			for (Pair<String, TypeName> property : methodParamsUsedAsParameter) {
				String resolvedName = method.findParameterNameByAlias(property.value0);
				methodBuilder.addJavadoc("\t<dt>$L</dt>", resolvedName);
				methodBuilder.addJavadoc("<dd>is binded to query's parameter <strong>"+SqlAnalyzer.PARAM_PREFIX+"$L"+SqlAnalyzer.PARAM_SUFFIX+"</strong></dd>\n", property.value0);
			}
			methodBuilder.addJavadoc("</dl>\n\n");
		}

		for (Pair<String, TypeName> param : method.getParameters()) {
			if (methodParamsUsedAsColumnValue.contains(param)) {
				methodBuilder.addJavadoc("@param $L\n", param.value0);
				
				if (entity.get(method.findParameterAliasByName(param.value0))!=null) {												
					methodBuilder.addJavadoc("\tis binded to column value <strong>$L</strong>\n", entity.get(method.findParameterAliasByName(param.value0)).columnName);
				} else {
					// in case of JQL explicit, you can declare name of parameter
					methodBuilder.addJavadoc("\tis binded to query parameter <strong>$L</strong>\n", param.value0);				}
			}

			if (methodParamsUsedAsParameter.contains(param)) {
				methodBuilder.addJavadoc("@param $L\n", param.value0);
				methodBuilder.addJavadoc("\tis used as parameter\n");
			}
		}

		generateJavaDocReturnType(methodBuilder, returnType);
		return sqlInsert;
	}
76319
def _select_sql(self, **kwargs):
        
        return 'SELECT {distinct}{modifier}{select}'.format(
              distinct='DISTINCT ' if self._distinct else '',
              modifier='{} '.format(' '.join(self._modifiers)) if self._modifiers else '',
              select=','.join(term.get_sql(with_alias=True, subquery=True, **kwargs)
                              for term in self._selects),
        )
707339
public EntityDesc createEntityDesc(TableMeta tableMeta) {
    String name = StringUtil.fromSnakeCaseToCamelCase(tableMeta.getName());
    return createEntityDesc(tableMeta, null, null, StringUtil.capitalize(name));
  }