Open kenyee opened 2 months ago
Huh. Are you using a query cache? Is it possible that something added the record to the database outside of ORMLite? I don't think the cache holds a miss however.
Are you sure you aren't reading inside of a transaction? That's the only way that I would think that data might be hidden that the command line sees.
Another dumb question: Are you sure that you are hitting the same database? This isn't an entity name issue somehow?
Sorry..should have mentioned: no query cache, no transaction. Entity name is correct. Small snippet of entity declaration:
@DatabaseTable(tableName = ActivityTable.TABLE_NAME)
@Root(strict = false)
public class ActivityItem {
@DatabaseField(columnName = ActivityTable.CREATE_DATE)
public String createDate;
@DatabaseField(columnName = ActivityTable.UPDATE_DATE)
public String updateDate;
@DatabaseField(columnName = ActivityTable.ID, id = true)
@Attribute
public Integer activityID;
The data doesn't change that often...it's synced down from the server, so the data is in there and I can see the queryForId return null.
Is there any way to have ormlite output all the data it retrieved from the DB instead of just output the queries it makes? Maybe that'll give me a better clue (i.e. if it reads data but doesn't convert it to an entity).
Sorry but it's not reading the data. It's just sending the SQL to the server and the server does the filtering.
Right, but it gets a cursor back and the values...I was wondering if it could also log the values for the rows it read before it converts the data into entity objects?
Hoping someone has seen this behavior and might be able to give me a clue. Google search and stackoverflow and chatgpt didn't find anything.
I'm running OrmLite for Android 6.1. I turned on sql logging and see this:
But using Android Studio's database inspector, I see that the row is there. I also pulled the database and ran the sqlite3 CLI against it and when I do sqlite> select * from activity where id = 8158845 I do see data. The app also has the same behavior on app start...I thought there might be some sort of issue w/ the data not being written to sqlite yet (no transactions are used).
I'm puzzled...this is not how I understand an ORM to work 🤔