-
Notifications
You must be signed in to change notification settings - Fork 583
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
id = null after create new record #12
Comments
Can you post your Conversation class too.. or see what's the difference between those two classes.. |
ah, I see the difference, I declare an attribute called id as Long in Conversations class, but I didn't declare it in Messages class. I've try to remove public Long id, and it's successfully work. Why it's error if we declare Long id in SugarRecord subclass Sir ? Message class :
} Conversations class :
} |
ok. There's a similar property "Long id" defined in the SugarRecord class too. During reflection, it seems to cause a conflict. |
thanks Sir :) |
I'm confused with this issue and don't know how to resolve it.
I write the code like this (some not related code was erased) :
In function saveToDb, if result.size() == 0 I create new record of Conversation class and then save it and return this object. And then I use the returned object to be parameter for function pushNotification. When function pushNotification read id of the object (c.id), it has value 0 and I get an error. I also have tried to debug this object value in each function and it shown that id has value 0 and others field have been filled with data I want to store in. In saveToDb function, I also save a new record of Messages class, and it has no error.
But if result.size is not 0, this all function is successfully done. what's wrong with my code ? why save a new record of Message class was successful but not for Conversation class ? :-/
The text was updated successfully, but these errors were encountered: