objectbox / objectbox/objectbox-java

Provide a way to force a refresh of the cached ToOne target

オープン
#1,002 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

enhancement
主要言語
Java
スター
4.6k
フォーク
311
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず ToOne リレーションシップ API の場所を確認し、既存の getTargetId() と target setter の動作を読みます。要求された refresh 操作を実装し、既知の box から関連エンティティを取得してキャッシュを更新し、そのエンティティを返すようにします。呼び出し側が box を手動で探さなくても、変更された target を refresh できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, java, kotlin
領域
databases, mobile-dev
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。