Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How are column names determined? #10

Open
bkjbkjbnkj687698698 opened this issue Mar 11, 2015 · 4 comments
Open

How are column names determined? #10

bkjbkjbnkj687698698 opened this issue Mar 11, 2015 · 4 comments

Comments

@bkjbkjbnkj687698698
Copy link

i am having issues using Contraints.If i don't use contraints data loads perfectly.But if i try running following query-

Constraint constraint = new Constraint().orderBy("noOfSeen");
List cached = adapter.findAll(database,constraint);

where noOfSeen is the variable of object class.I assumed that the table in [persistence][2] creates column name according to the variable name in object class.
but i get following exception

android.database.sqlite.SQLiteException: no such column: noOfSeen (code 1): , while compiling: SELECT * FROM videos ORDER BY noOfSeen

How are column names determined while creating table through this wrapper.How can i use following query of normal database in this wrapper?

"SELECT  * FROM " + TABLE_VIDEO +" where " + KEY_TYPE + "='popular'"+ " order by " + KEY_NOSEEN + " DESC "
@casidiablo
Copy link
Owner

The column should be snake case: no_of_seen. You can control that by using annotations in the pojo fields.

@bkjbkjbnkj687698698
Copy link
Author

Are the column names according to the variables used in object classes..and how can we execute where clauses using this library?

@razorblade446
Copy link
Collaborator

The column names are camelized counterparts of the variables, so:

NoOfSeen (POJO) -> no_of_seen (SQLite)

Frederic Yesid Peña Sánchez
Web Developer - Designer
PHP - MySQL advanced Programmer
Tigo proud user IVR

Date: Wed, 11 Mar 2015 12:24:52 -0700
From: [email protected]
To: [email protected]
Subject: Re: [persistence] How are column names determined? (#10)

Are the column names according to the variables used in object classes..and how can we execute where clauses using this library?


Reply to this email directly or view it on GitHub.

@casidiablo
Copy link
Owner

@bhuvneshvarma There are examples in the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants