objectbox / objectbox/objectbox-java
Provide a way to force a refresh of the cached ToOne target
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 4.6k
- Fork
- 311
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xác định API quan hệ ToOne và đọc hành vi hiện có của getTargetId() và target setter. Triển khai thao tác refresh được yêu cầu để lấy entity liên quan từ box đã biết của nó, cập nhật cache và trả về entity; hoàn tất có nghĩa là các bên gọi có thể refresh một target đã thay đổi mà không cần tự tìm box.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, java, kotlin
- Lĩnh vực
- databases, mobile-dev
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100