[
https://issues.apache.org/jira/browse/METAMODEL-251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15282511#comment-15282511
]
Hans Drexler commented on METAMODEL-251:
----------------------------------------
Adding comment from Dennis:
{quote}
I actually think it's much simpler problem than being JDBC-like or not; Someone
asks to retrieve a set of values from some kind of datastore (SQL or
otherwise). When done, they suddenly try to retrieve another set of values.
That's most probably a bug in their code, and in my mind we should explode
immediately.
I wouldn't compare it to a Map. A Map just returns null, because it is a
general purpose structure that can't start limiting uses like that. We can, and
IMHO we should.
(By the way, JIRA is up again. I mostly reply here because my reply would seem
weird on its own :))
{quote}
> 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)