A bug fix made in 4.37 introduced an incompatibility under Android with mismatched column-name case between the Java field and the database. I have made a decision to _not_ fix this incompatibility and to keep the case sensitivity since there are other parts of ORMLite which are also case sensitive with regards to field names. I've added these upgrade notes for version 4.37 in retrospect.
If you have a field in your Android SQLite that is named 'accountname' but the Java field is 'accountName' then as of 4.37 you will get an exception when you query for that object.
java.sql.SQLException: Unknown field 'accountName' from the Android sqlite cursor, not in:[accountname, ...]"
To fix it, you will need to use the @DatabaseField(columnName = "accountname") annotation field:
@DatabaseField(columnName = "accountname")
private String accountName;
Sorry for the confusion on this and sorry for the backwards incompatibility. Although painful for some folks to upgrade, I feel it is the right thing to do.
Thanks much to Roman Zimmer for bringing this to my attention.
gray
> Gray, can you confirm this for anyone else who may have misinterpreted
> this as I did and might be worried about the upgrade?
I can certainly confirm this. Sorry for the confusion. I will expand the 4.37 release notes.
thanks JC,
gray
There was some confusion so let me be clear that this is _only_ if you already have mismatched between your database fields and your Java under Android SQLite. If you used ORMLite to create your schema _or_ if you used @DatabaseField(columnName = ...) to make your case match then you would not see this issue.
This only would affect people who were working with an _existing_ database whose fields did not match the Java. The Android API was looking up fields in a case insensitive manner so was masking problems with this.
I've reposted the Upgrade documentation which hopefully is more clear:
gray
> So is the best option to take to simply fully qualify the field name for all columns. This will mean that the case sensitivity issue will not arise in the future i.e. always specifying the column name with annotated fields. @DatabaseField(columnName = ...)
No, that _really_ is not necessary. If the field-name is accountName then the database field should match exactly. Only if the field name does _not_ .equals the database field name do you have to worry about it.
gray