-
Notifications
You must be signed in to change notification settings - Fork 308
Support data observers for related entities #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think the following code could also trigger changes in data observers: item.notes.add(Note())
item.notes.applyChangesToDb() |
I thought we have tracked that already, but did not find it... |
It will throw an exception if you try to call it on untracked changes. Like if it's first time you're putting that |
Seems like abondened issue |
@mecoFarid If you are interested in this feature, please thumbs up the first post! |
@greenrobot-team Could be an unrelated place to ask but is there any workaround other than |
@mecoFarid Not sure what you mean, calling A workaround to not getting notifications on related entities is to observe the box of the related entity as well. Using the above example:
|
Please vote for #59 |
Hm, actually might want to keep this separate. Reopening. |
Hi, Is there any update on this issue? @Entity
data class Habit(
@Id var id: Long = 0L,
var name: String = "",
) {
@Backlink
lateinit var progress: ToMany<Progress>
}
@Entity
data class Progress(
@Id var id: Long = 0L,
@Convert(converter = LocalDateConverter::class, dbType = Date::class)
val preformDate: LocalDate = LocalDate.now(),
var performCount: Int = 0,
) {
lateinit var habit: ToOne<Habit>
}
I want to Observe the changes in both habit and progress. If there are changes to the progress object there should be a change event but at the moment it is not so. The change listener doesn't get triggered when there is a change in the nested entity of the habit. Even if I observe the Progress entity separately there should be a way to tell the habit entity to refresh its toMany collection. Observing nested entities separately makes no sense in this case since the parent entity already encapsulates them both and we have attached a change listener to it. This seems similar approach to how the SQL databases do the job. But in SQL we could do this with a left join specifically. Nevertheless, it feels a little unnatural to do this in a NoSQL Database. |
@BobFactory No updates. |
Note these related feature requests:
This might be a feature request.
It seems that currently it is not possible to listen for nested changes.
Entities
The text was updated successfully, but these errors were encountered: