You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "Kasper Sørensen (JIRA)" <ji...@apache.org> on 2015/01/24 10:46:34 UTC
[jira] [Created] (METAMODEL-107) Less confusing method names when
building where clauses
Kasper Sørensen created METAMODEL-107:
-----------------------------------------
Summary: Less confusing method names when building where clauses
Key: METAMODEL-107
URL: https://issues.apache.org/jira/browse/METAMODEL-107
Project: Apache MetaModel
Issue Type: Wish
Reporter: Kasper Sørensen
Priority: Minor
I've noticed a few times in our team that we keep making this mistake:
We have two columns that we want to use for a filter where they should for instance be equal. Kinda like:
{code}
SELECT ... FROM ... WHERE col1 = col2
{code}
So in MetaModel we might code this like this:
{code}
.query()... .where("col1").eq("col2") ...
{code}
The trouble is that then "col2" will be evaluated as a literal string, so the created query will rather be like
{code}
SELECT ...: FROM ... WHERE col1 = "col2"
{code}
Obviously that doesn't work. Our solution it to traverse the schema model and set the where clause using Column objects instead of strings. But that's actually not always very convenient. So it would be nice if we had methods to specify a column name in the query builder. Maybe just with something a la "eqCol(...)":
{code}
.query()... .where("col1").eqCol("col2") ...
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)