metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hans Drexler (JIRA)" <>
Subject [jira] [Commented] (METAMODEL-251) MetaModel should fail when accessing a column that is not a select item
Date Fri, 13 May 2016 07:57:12 GMT


Hans Drexler commented on METAMODEL-251:

Adding comment from Kasper:

Since JIRA is unavailable, I will reply to the discussion of
METAMODEL-251 [1] via mail...

I agree that the change would make MetaModel more "JDBC like". But I don't see JDBC as a very
good rolemodel for MetaModel, rather I just feel that MetaModel lends on SQL as a query structure
rather than JDBC itself. At least I don't think that there's an intrinsic value in being "JDBC
like" for us since it seems most people anyway prefer higher level APIs such as JPA, LINQ
or ... MetaModel :-)

Maybe we can start by adding the containsColumn(Column) and
containsSelectItem(SelectItem) methods to the Row interface? That should be doable without
breaking too many things. Then you could consider adding a StrictRow class as a wrapper around
it. Even just for debugging your issue?

An alternative would also be to have some kind of system property which we could set to influence
what type of behaviour we want - to determine if we would return null or throw an exception.

> MetaModel should fail when accessing a column that is not a select item
> -----------------------------------------------------------------------
>                 Key: METAMODEL-251
>                 URL:
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 4.5.2
>         Environment: Postgres
>            Reporter: Hans Drexler
>         Attachments:
> 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}
>              .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
> 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

View raw message