Can not generate greenDao Entity with lowercase

738 Views Asked by At

I am using GreenDao library in my project and I have a problem when I want to read from DB, it gives me android.database.sqlite.SQLiteException: no such table.

I know the reason why this happens. Its because when I generate the Scheme and add entity like this: addEntity("userX") the generated table is USER_X.

The problem is that I have loaded the db from assets and the table name is userX, not USER_X. I read in the greendao doc that: For example, a property called “creationDate” will become a database column “CREATION_DATE”.

My question is how can I change these defaults ? I have searched in documentation for a solution but I havent found any solution. Is there a solution for my problem?

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

I've never used it, but looking at this documentation and this source code, it seems possible using this method for entities

Entity e = addEntity("userX");
e.setTableName("userX");

and this for properties

e.addDateProperty("creationDate").columnName("creationDate");