Queries do not find the proper field on db when the field is renamed using @NameInDb
@Entity
public class MyClass {
@Id
long id;
@NameInDb("someField")
String mSomeField;
}
List<MyClass> result = mBox.query()
.equal(MyClass_.mSomeField, "some value")
.build()
.find();
Caused by: io.objectbox.exception.DbException: Could not prepare entity field MyClass.someField (Ljava/lang/String;) - does the field exist with the expected type?
at io.objectbox.query.Query.nativeFind(Native Method)
at io.objectbox.query.Query$3.call(Query.java:227)
at io.objectbox.query.Query$3.call(Query.java:224)
at io.objectbox.BoxStore.callInReadTx(BoxStore.java:668)
at io.objectbox.BoxStore.callInReadTxWithRetry(BoxStore.java:614)
at io.objectbox.query.Query.callInReadTx(Query.java:304)
at io.objectbox.query.Query.find(Query.java:224)
Will look into this for the upcoming version. Thanks for reporting.
We could reproduce this using internal integration tests. -ut
I have same problem in a integration tests too
Caused by: io.objectbox.exception.DbException: Could not prepare entity field Sample.property (L[F;) - does the field exist with the expected type?
at io.objectbox.query.Query.nativeFind(Native Method)
at io.objectbox.query.Query$3.call(Query.java:227)
at io.objectbox.query.Query$3.call(Query.java:224)
at io.objectbox.BoxStore.callInReadTx(BoxStore.java:689)
ObjectBox 1.4.1
But I have no @NameInDb on property
@kirich1409 ObjectBox can not handle float arrays out of the box (I assume Sample.property is one because the error messages indicates the type descriptor is L[F;). Have you specified a custom type converter? -ut
Yes. I've specified custom type converter annotation
I think it maybe Kotlin setting annotation on property, need to try it in Java code
@greenrobot-team same problem ObjectBox 1.4.1
at io.objectbox.query.Query.nativeFind(Native Method)
at io.objectbox.query.Query$3.call(Query.java:227)
at io.objectbox.query.Query$3.call(Query.java:224)
at io.objectbox.BoxStore.callInReadTx(BoxStore.java:671)
@kirich1409 @rogerou Could you post the property definition in your entity including its annotations?
@greenrobot


@greenrobot tested on 2 different devices , one is huawei p9 just update to android 8.0 which will crash, another one is xiaomi5 is android 7.0 do not have any problem
@rogerou Now you scare me ;-) Are you 100% sure this is OS dependent?
@greenrobot My class with problem is
@Entity
class Page(
@Id @JvmField internal var id: Long = 0,
@JvmField @Convert(converter = FloatArrayConverter::class, dbType = String::class) var documentBounds: FloatArray? = null
)
and I have problem with property documentBounds on Android 8.0 (physical device & emulator) and have no problem an Android 7.0 (physical device) & Android 6.0 (emulator).
@rogerou @kirich1409 @greenrobot Alright. As this float[] issue is not related to the original @NameInDb it should get its own issue. -ut
@greenrobot I've created new issue "Could not prepare entity field for FloatArray with converter in instrumentation tests on Android 8.0+"
Fixed, please confirm with V1.4.4
Most helpful comment
Will look into this for the upcoming version. Thanks for reporting.