j256 / ormlite-android

ORMLite Android functionality used in conjunction with ormlite-core
http://ormlite.com/
ISC License
1.59k stars 367 forks source link

java.lang.IllegalArgumentException: Unknown column name 'mobile' in table account_metric_usage #78

Open mapayares opened 7 years ago

mapayares commented 7 years ago

the column "mobile" does indeed exists in my table. I am running mySQL database version 5.8+

here is my java code that throws the exception

Where<T, Integer> query = dao.queryBuilder().selectColumns("mobile").where().eq(ACCOUNT, account).and().ge(DATE, startStamp).and().le(DATE, endStamp);

the selectColumns only takes strings or iterator

if i run this query on my database. i get the desired behavior

SELECT mobile FROM account_profile_metric_usage WHERE ((account = 'qa23-redis-smoke' AND date >= '2017-01-28' ) AND date <= '2017-02-27' )

if i run this query it fails to return the desired behavior

SELECT 'mobile' FROM account_profile_metric_usage WHERE ((account = 'qa23-redis-smoke' AND date >= '2017-01-28' ) AND date <= '2017-02-27' )

i need to be able to run the first SQL query in my Java code. Is it possible with Ormlite using the selectColumn??