question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@NameInDb does not work

See original GitHub issue

Issue Basics

  • ObjectBox version (are using the latest version?): 1.4.0
  • Reproducibility: always

Reproducing the bug

Description

Queries do not find the proper field on db when the field is renamed using @NameInDb

Code

@Entity
public class MyClass {

    @Id
    long id;

    @NameInDb("someField")
    String mSomeField;
}
List<MyClass> result = mBox.query()
                .equal(MyClass_.mSomeField, "some value")
                .build()
                .find();

Logs & stackstraces

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)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
greenrobotcommented, Jan 18, 2018

Will look into this for the upcoming version. Thanks for reporting.

2reactions
greenrobotcommented, Mar 8, 2018

Fixed, please confirm with V1.4.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Greendao Autoincrement inserting record not working
I have used it as below and it is working fine. @Entity(nameInDb = "cities") public class City { @Id(autoincrement = true) private Long...
Read more >
[pset8] finance - check: javascript does not work : r/cs50 - Reddit
I am struggling with the part of check that checks if the username is taken via javascript. My javascript code seems not to...
Read more >
yun_dao - Dart API docs - Pub.dev
1.Create entity file which names *_entity. · 2.Use @Entity to annotate entity class; use nameInDb property to define the database table name of...
Read more >
Java Release History (<= v1.5) - ObjectBox Docs
Entity can be named Property , no longer conflicts with ObjectBox Property class. Property queries for strings crashed on some Android devices if...
Read more >
Modelling entities - Open Source by greenrobot
// Specifies the name of the table in the database. // By default, the name is based on the entities class name. nameInDb ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found