roscopeco/ormdroid

Problem with the Sample (where function)

Closed this issue · 3 comments

I have downloaded the sample from http://orm-droid.googlecode.com/svn/trunk/ORMSample
I am getting and error with the following method in Person class.

public List people() {
return query(Person.class).where("department").eq(id).executeMulti();
}

The argument for where is invalid because its expecting type com.roscopeco.ormdroid.SQLExpression while the passed argument is String.

Same error is present in the activity classes,when calling the where method

Please advise me how to fix this

Hi,

The query API has changed in the most recent version of ORMDroid, to allow
more flexibility with queries. The latest ORMSample from git should work
fine with the new API.

If you want to fix the version you have downloaded, just change the 'return
query' line to read:

return query(Person.class).where(eql("department", id)).executeMulti();

and add an 'import static com.roscopeco.ormdroid.Query.eql' to your import
statements (alternatively, you could explicitly call
Query.eql("department", id) if you liked, but I find the import static
easier in most cases).

Hope that helps,
Ross

On Tue, Feb 26, 2013 at 4:01 PM, Khurram Majeed notifications@github.comwrote:

I have downloaded the sample from
http://orm-droid.googlecode.com/svn/trunk/ORMSample
I am getting and error with the following method in Person class.

public List people() {
return query(Person.class).where("department").eq(id).executeMulti();
}

The argument for where is invalid because its expecting type
com.roscopeco.ormdroid.SQLExpression while the passed argument is String.

Please advise me how to fix this


Reply to this email directly or view it on GitHubhttps://github.com//issues/5
.

Thank you for the reply this fixed the problem for the old Sample.
Since you mentioned the new Sample on Github, I can't find it. Can you please provide the link?

My apologies, I meant Google code. I have just now migrated the sample over to Github however - it's at https://github.com/roscopeco/ormdroid-example .