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.

DbException: Order: Unsupported type for property price_amount (Float)

See original GitHub issue

Issue Basics

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

Reproducing the bug

Description

I try to sort a list of entities of type SoluteNOffer by a Float-property with the name price_amount, which fails with a DbException: Order: Unsupported type for property price_amount.

I did not find any information anywhere about which field-types are supported for ordering result-collections or that there are any restrictions in place.

The stacktrace points to QueryBuilder.nativeBuild(Native Method), which doesn’t help either.

Why isn’t ordering of Float-properties supported and is there a list of supported property-types?

Thank you for looking into this!

Arne Jans

Code

The generated property of the Property-class SoluteNOffer_ looks like this: public final static Property price_amount = new Property(9, 10, Float.class, "price_amount"); The query-code with the order-statement looks like this:

    public List<SoluteNOffer> getSoluteNOffersById(long[] offerIds) {
        Box<SoluteNOffer> offerBox = getBoxStore().boxFor(SoluteNOffer.class);
        return offerBox.query()
                .in(SoluteNOffer_.id, offerIds)
                .order(SoluteNOffer_.price_amount)
                .build().find();
    }

Logs & stackstraces

java.lang.RuntimeException: Unable to start activity ComponentInfo{de.pricepretzel.android/de.billiger.android.sparberater.activities.OfferListActivity}: io.objectbox.exception.DbException: Order: Unsupported type for property price_amount
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
 Caused by: io.objectbox.exception.DbException: Order: Unsupported type for property price_amount
    at io.objectbox.query.QueryBuilder.nativeBuild(Native Method)
    at io.objectbox.query.QueryBuilder.build(QueryBuilder.java:164)
    at de.billiger.android.sparberater.service.api.soluten.persistence.SoluteNBoxStore.getSoluteNOffersById(SoluteNBoxStore.java:67)

Entities

@Entity
public class SoluteNOffer {
    public Float price_amount;
}

Misc

Would introducing an int-property and using it for ordering work around this issue, or is there a better approach?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ajanscommented, Oct 27, 2017

Yes, it is working now as intended. Thanks!

0reactions
greenrobotcommented, Jan 13, 2022

@marek-embiq This is an old closed issue. Please open a new one with info & code required to reproduce. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I solve TypeError: unsupported operand type(s) for
I tried to do calculation by retrieving values by its index and column name for any pair of two rows in a for...
Read more >
TypeError: unsupported operand type(s) for *: 'float' and ...
When defining the parameters in a python toolbox, it may be sufficient to change the data type to GPRasterLayer or GPRasterDataset.
Read more >
ArcObjects WriteOnly Properties are not accessible and throw ...
ArcObjects WriteOnly Properties are not accessible and throw “BC30643 Property is of an unsupported type” compile error in Microsoft Visual ...
Read more >
TypeError unsupported operand type s for - str and str - Edureka
Hi. I am new to Python and I am practicing to code. But I am facing some issues. >>> a=input(' ... ' and...
Read more >
'Unsupported type' error in custom editor script - Unity Answers
public float m_TriggerTime = -1.0f;; public string m_LevelObjectName = ""; ...
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