[
https://issues.apache.org/jira/browse/METAMODEL-94?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14204698#comment-14204698
]
Kasper Sørensen commented on METAMODEL-94:
------------------------------------------
hmm yes ... I guess materializeMainSchemaTableInternal should take the
List<SelectItem> as a parameter to retain all the select item information.
> [MongoDbDataContext] The alias will be lost,unless we use FunctionType
> ----------------------------------------------------------------------
>
> Key: METAMODEL-94
> URL: https://issues.apache.org/jira/browse/METAMODEL-94
> Project: Metamodel
> Issue Type: Bug
> Affects Versions: 4.1.0-incubating, 4.2.0-incubating
> Reporter: xgl1991714
>
> here is the method 'executeQuery()' of MongoDbDataContext:
> {quote}
> *public* DataSet executeQuery(Query query) {
> ...
> *boolean* allSelectItemsAreColumns = *true*;
> List<SelectItem> selectItems =
> query.getSelectClause().getItems();
> *for* (SelectItem selectItem : selectItems) {
> *if* (selectItem.getFunction() != *null* || selectItem.getColumn() == *null*){
> allSelectItemsAreColumns = false;
> break;
> }
> }
> *if* (allSelectItemsAreColumns) {
> ...
> *final* DataSet dataSet =
> materializeMainSchemaTableInternal(table, columns, whereItems, firstRow,
> maxRows, *false*);
> *return* {color:red}dataSet{color};
> }
> *return* {color:red}super.executeQuery(query){color};
> }
> {quote}
> when I run:
> {quote}
> mongoDbDataContext.query().from({color:blue}"dept"{color}).select({color:blue}"dname"{color}).as({color:blue}"xxx"{color})
> {quote}
> the +allSelectItemsAreColumns+ is *true* and the alias is lost
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)