Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8202157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:04:38+00:00 2026-06-07T07:04:38+00:00

I have my ORMlite service working fine. All CRUD operations work fine. However when

  • 0

I have my ORMlite service working fine. All CRUD operations work fine.
However when I add a new nullable field to my entity, the whole thing fails. I get null pointers and the application dies.

This is the field I added:

@DatabaseField( canBeNull = true  )
private String newField;

If I drop my DB and recreate it then everything is fine. What I would like to know is why does a simple schema change cause this? I’m thinking ahead where a DB is full with data and I don’t want a new nullable field to break it or is this to be expected?

Here’s the exception:

W/System.err(16955): java.sql.SQLException: Unknown field 'newField' from the Android sqlite cursor, not in:[desc, name, id]
W/System.err(16955):    at com.j256.ormlite.android.AndroidDatabaseResults.findColumn(AndroidDatabaseResults.java:97)
W/System.err(16955):    at com.j256.ormlite.field.FieldType.resultToJava(FieldType.java:793)
W/System.err(16955):    at com.j256.ormlite.stmt.mapped.BaseMappedQuery.mapRow(BaseMappedQuery.java:60)
W/System.err(16955):    at com.j256.ormlite.stmt.SelectIterator.getCurrent(SelectIterator.java:270)

Here is the exception I’m getting when I update my entity class to include the following new field.

@DatabaseField( canBeNull = true  )
private String newField;

Now seeing that if I remove the new field my test case/app works fine then it is this code that breaks things .

[2012-07-05 22:42:00 - WishListManager] Success!
[2012-07-05 22:42:00 - WishListManagerTest] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554
[2012-07-05 22:42:00 - WishListManagerTest] Collecting test information
[2012-07-05 22:42:02 - WishListManagerTest] Sending test information to Eclipse
[2012-07-05 22:42:02 - WishListManagerTest] Running tests...
[2012-07-05 22:42:04 - WishListManagerTest] Test run failed: Instrumentation run failed due to 'java.lang.NullPointerException'
[2012-07-05 22:42:04 - WishListManagerTest] Test run finished


07-05 21:42:02.084: I/TestRunner(16955): started: testAddDuplicateWishLists(com.tests.WishListServiceTest)
07-05 21:42:02.504: I/global(16955): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
07-05 21:42:02.524: I/global(16955): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
07-05 21:42:02.654: D/dalvikvm(16955): GC_FOR_MALLOC freed 4623 objects / 361912 bytes in 63ms
07-05 21:42:02.754: I/global(16955): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
07-05 21:42:02.764: I/global(16955): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
07-05 21:42:02.774: W/System.err(16955): java.sql.SQLException: Unknown field 'newField' from the Android sqlite cursor, not in:[desc, name, id]
07-05 21:42:02.784: W/System.err(16955):    at com.j256.ormlite.android.AndroidDatabaseResults.findColumn(AndroidDatabaseResults.java:97)
07-05 21:42:02.784: W/System.err(16955):    at com.j256.ormlite.field.FieldType.resultToJava(FieldType.java:793)
07-05 21:42:02.784: W/System.err(16955):    at com.j256.ormlite.stmt.mapped.BaseMappedQuery.mapRow(BaseMappedQuery.java:60)
07-05 21:42:02.784: W/System.err(16955):    at com.j256.ormlite.stmt.SelectIterator.getCurrent(SelectIterator.java:270)
07-05 21:42:02.784: W/System.err(16955):    at com.j256.ormlite.stmt.SelectIterator.nextThrow(SelectIterator.java:161)
07-05 21:42:02.784: W/System.err(16955):    at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:161)
07-05 21:42:02.784: W/System.err(16955):    at com.j256.ormlite.stmt.StatementExecutor.queryForAll(StatementExecutor.java:113)
07-05 21:42:02.784: W/System.err(16955):    at com.j256.ormlite.dao.BaseDaoImpl.queryForAll(BaseDaoImpl.java:237)
07-05 21:42:02.784: W/System.err(16955):    at com.test.db.WishListService.getAllWishLists(WishListService.java:42)
07-05 21:42:02.784: W/System.err(16955):    at com.test.WishListManagerActivity.setupListView(WishListManagerActivity.java:48)
07-05 21:42:02.784: W/System.err(16955):    at com.test.WishListManagerActivity.onStart(WishListManagerActivity.java:44)
07-05 21:42:02.784: W/System.err(16955):    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
07-05 21:42:02.784: W/System.err(16955):    at android.app.Activity.performStart(Activity.java:3781)
07-05 21:42:02.784: W/System.err(16955):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2636)
07-05 21:42:02.784: W/System.err(16955):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-05 21:42:02.794: W/System.err(16955):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-05 21:42:02.794: W/System.err(16955):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-05 21:42:02.794: W/System.err(16955):    at android.os.Handler.dispatchMessage(Handler.java:99)
07-05 21:42:02.794: W/System.err(16955):    at android.os.Looper.loop(Looper.java:123)
07-05 21:42:02.794: W/System.err(16955):    at android.app.ActivityThread.main(ActivityThread.java:4627)
07-05 21:42:02.794: W/System.err(16955):    at java.lang.reflect.Method.invokeNative(Native Method)
07-05 21:42:02.794: W/System.err(16955):    at java.lang.reflect.Method.invoke(Method.java:521)
07-05 21:42:02.794: W/System.err(16955):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-05 21:42:02.794: W/System.err(16955):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-05 21:42:02.794: W/System.err(16955):    at dalvik.system.NativeStart.main(Native Method)
07-05 21:42:02.804: D/AndroidRuntime(16955): Shutting down VM
07-05 21:42:02.804: W/dalvikvm(16955): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-05 21:42:02.814: E/AndroidRuntime(16955): FATAL EXCEPTION: main
07-05 21:42:02.814: E/AndroidRuntime(16955): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/com.test.WishListManagerActivity}: java.lang.NullPointerException
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.os.Handler.dispatchMessage(Handler.java:99)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.os.Looper.loop(Looper.java:123)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.app.ActivityThread.main(ActivityThread.java:4627)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at java.lang.reflect.Method.invokeNative(Native Method)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at java.lang.reflect.Method.invoke(Method.java:521)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at dalvik.system.NativeStart.main(Native Method)
07-05 21:42:02.814: E/AndroidRuntime(16955): Caused by: java.lang.NullPointerException
07-05 21:42:02.814: E/AndroidRuntime(16955):    at com.test.WishListManagerActivity.setupListView(WishListManagerActivity.java:51)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at com.test.WishListManagerActivity.onStart(WishListManagerActivity.java:44)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.app.Activity.performStart(Activity.java:3781)
07-05 21:42:02.814: E/AndroidRuntime(16955):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2636)
07-05 21:42:02.814: E/AndroidRuntime(16955):    ... 11 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:04:40+00:00Added an answer on June 7, 2026 at 7:04 am

    I have my ORMlite service working fine. All CRUD operations work fine. However when I add a new nullable field to my entity, the whole thing fails.

    So the ORMLite exception seems to me to be pretty helpful:

    java.sql.SQLException: Unknown field 'newField' from the Android sqlite cursor,
        not in:[desc, name, id]
    

    You are trying to extract the newField field but it is not in the database table. This indicates to me that you did not update the schema of the database. The only fields it has in the table are desc, name, and id.

    Either the code that is upgrading the database table has not been run or it is not working correctly. I would take a look at the documentation page that I wrote about how to upgrade the schema under Android.

    Unfortunately, Sqlite supports only a few ALTER TABLE commands but ADD COLUMN is one of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i am using ORMLite 4.33. I have an entity class that gives me
Have converted devise new session from erb to Haml but doens't work, this is
I have been trying to work through the HelloAndroid example for ORMLite but haven't
I understand the ORMLite Android examples . However, I have more than one class
I have just started reading about ORMLite since I am interested in using it
I'm using ormlite for my android-app. But now i have a problem. I have
Have deployed numerous report parts which reference the same view however one of them
I have a class which I want to persist with OrmLite and it stores
**Have it working now. I forgot to populate the Array List. How embarrassing. I'm
Have a rather abstract question for you all. I'm looking at getting involved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.