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.

ToMany is automatically sorted by Entity id

See original GitHub issue

Issue Basics

  • ObjectBox version (are using the latest version?): 1.4.4
  • Reproducibility: Always

Reproducing the bug

Description

I have an Entity ExerciseEntity that contains a ToMany of BodypartEntity.

When creating a new ExerciseEntity, bodyparts are specified as A,B,C. Their ordering is important.

After inserting the entity into the Box, later on it will contain the bodyparts with a completely different order (e.g. B,A,C). From what I can tell theyre always sorted by their id annotated value.

Code

ExerciseEntity has lateinit var bodyparts: ToMany<BodypartEntity> When creating a new one its assigned as entity.bodyparts.addAll(bodyparts)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
greenrobotcommented, Apr 16, 2018

PS.: There’s also an experimental setComparator(c) method in ToMany class, which you could set before the list is loaded.

0reactions
greenrobot-teamcommented, Apr 17, 2018

Closing this then.

Edit: this is also a duplicate of #243 and #154. -ut

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatically set related entity id in one to many relationship ...
I have a many to one related entities and everytime I create a new comment which is related to Project, I want to...
Read more >
Ordering vs Sorting with Hibernate - What should you use?
When use sorting, Hibernate will load the associated Book entities from the ... AUTO). @Column (name = "id" , updatable = false ,...
Read more >
Many-to-one / one-to-many relations - typeorm - GitBook
Where you set @ManyToOne - its related entity will have "relation id" and foreign key. This example will produce following tables:.
Read more >
Collections | MikroORM
This will give us the entity instances managed by the identity map. ... Since v3 many to many collections does not require having...
Read more >
XML Mapping - Doctrine Object Relational Mapper (ORM)
In order to tell the XmlDriver where to look for your mapping documents, supply an ... is only used for primitive types that...
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