[ https://issues.apache.org/jira/browse/METAMODEL-251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15282510#comment-15282510 ]
Hans Drexler commented on METAMODEL-251: ---------------------------------------- Adding comment from Kasper: {quote} 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. {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)