You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "Hans Drexler (JIRA)" <ji...@apache.org> on 2016/05/11 11:51:12 UTC

[jira] [Updated] (METAMODEL-251) MetaModel should fail when accessing a column that is not a select item

     [ https://issues.apache.org/jira/browse/METAMODEL-251?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hans Drexler updated METAMODEL-251:
-----------------------------------
    Attachment: MetaModel251Sample.java

Sample program outlining the problem.

> MetaModel should fail when accessing a column that is not a select item
> -----------------------------------------------------------------------
>
>                 Key: METAMODEL-251
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-251
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 4.5.2
>         Environment: Postgres
>            Reporter: Hans Drexler
>         Attachments: MetaModel251Sample.java
>
>
> In our software, we create a query with SelectItems for 6 out of the 7 columns of a postgres data base table. We actually forgot to add the seventh column as a SelectItem.
> {code}
>         query.select(selectItems)
>              .from(someTable)
> {code}
> When consuming the rows returned by this query, the code actually fetches the column that was not a select item, using a construct like:
> {code}
> row.getValue(table.getColumnByName('foo'));
> {code}
> This returns null values most of the time. But under stress, the code starts to throw exceptions. 
> It would be much better if MetaModel throws an exception when the code attempts to access a column that is not part of the query (fail fast).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)