objectbox / objectbox/objectbox-java
Provide a way to force a refresh of the cached ToOne target
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 4.6k
- Forks
- 311
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
When the target entity of a ToOne relationship is changed after it's resolved and cached, there is no way to force the target to refresh from the database.
Describe the solution you'd like
Provide a function that can be called that forces a new "get" from the box, caches the new entity, and returns it. This can be used when the app knows that the entity has been updated but wants those changes reflected in the related object.
Describe alternatives you've considered
As a workaround/alternative, the app can find the correct box, get an updated entity using the getTargetId(), then set the ToOne target entity to the updated entity. This works but requires a lot of extra code for something it feels like objectbox should be able to handle (especially since the ToOne relationship already knows the correct box for the get operation).
Additional context
Currently using this on Kotlin/Android.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par localiser l’API de relation ToOne et lire le comportement existant de getTargetId() et du target setter. Implémentez l’opération d’actualisation demandée afin qu’elle récupère l’entité associée depuis sa box connue, mette à jour le cache et renvoie l’entité ; le travail est terminé lorsque les appelants peuvent actualiser une cible modifiée sans avoir à trouver la box manuellement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- android, java, kotlin
- Domaine
- databases, mobile-dev
- Type d'issue
- Fonctionnalité
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100