You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When put call is called it give error in log as:
I/Box: Pending Java Exception detected: Could not create entity object
ObjectBox version: 3.0.1
Reproducibility: always
Device: Samsung Galaxy M21
OS: Android 11
To Reproduce
Steps to reproduce the behavior:
Create the entity class
Call removeAll and put calls in runInTx
See error
Expected behavior
It should enter the entities
Code
Entity Class
@Entity
data class RepositoryEntity(
@Id(assignable = true) var id: Long = 0,
@SerializedName("name") val name: String = "",
@SerializedName("html_url") val repoUrl: String = "",
@SerializedName("language") val language: String = "",
@SerializedName("stargazers_count") val starCount: Int = 0,
@SerializedName("forks_count") val forksCount: Int = 0,
@SerializedName("avatar_url") val avatarUrl: String = ""
)
Method to remove all and put all entities, where the error occurs at put method:
fun saveData(data: List<RepositoryEntity>) {
CoroutineScope(Dispatchers.IO).launch {
boxStore.runInTx {
boxStore.boxFor<RepositoryEntity>()
.removeAll() // deleting and inserting data to avoid sync issues
boxStore.boxFor<RepositoryEntity>().put(data)
}
}
}
Logs, stack traces
Relevant logs, or a stack trace.
I/Box: Pending Java Exception detected: Could not create entity object
The text was updated successfully, but these errors were encountered:
However, the RepositoryEntity class you supplied does have a valid no-arg constructor. Also this exception is only thrown when reading entities, e.g. with get or a query. It is likely that this code and entity is not the cause.
So can you provide a full stack trace to see where this issue actually originates?
@greenrobot-team Just a side note... Because of "Pending Java Exception detected": can we repro this in our Java tests? Might help us internally to better pin this down in the future.
@greenrobot Not so far. The odd thing is that the annotation processor should already error since 3.0.0 if no required constructor exists. And when circumventing that, the exception message from the core APIs is actually something like:
io.objectbox.exception.DbSchemaException: Entity is expected to have this constructor: TestEntity(JZBSIJFDLjava/lang/String;[B[Ljava/lang/String;Ljava/util/List;SIJ)V
at io.objectbox.Cursor.nativeGetEntity(Native Method)
at io.objectbox.Cursor.get(Cursor.java:196)
at io.objectbox.Box.get(Box.java:210)
Without additional information, we are unfortunately not sure how to resolve this issue. Therefore this issue has been automatically closed. Feel free to comment with additional details and we can re-open this issue.
Describe the bug
When put call is called it give error in log as:
I/Box: Pending Java Exception detected: Could not create entity object
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should enter the entities
Code
Entity Class
Method to remove all and put all entities, where the error occurs at put method:
Logs, stack traces
Relevant logs, or a stack trace.
I/Box: Pending Java Exception detected: Could not create entity object
The text was updated successfully, but these errors were encountered: