objectbox / objectbox/objectbox-java

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

Abierto
#1,002 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

enhancement
Lenguaje dominante
Java
Estrellas
4.6k
Forks
311
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza localizando la API de relaciones ToOne y leyendo el comportamiento existente de getTargetId() y del target setter. Implementa la operación de actualización solicitada para que obtenga la entidad relacionada de su box conocida, actualice la caché y devuelva la entidad; la tarea estará terminada cuando los llamadores puedan actualizar un target modificado sin tener que encontrar la box manualmente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
android, java, kotlin
Área
databases, mobile-dev
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.