objectbox / objectbox/objectbox-java

How to listen to the first of ToMany

Open
#568 4 comments 0 reactions 1 assignee View on GitHub

@greenrobot-team is already working on this.

Since Oct 1, 2018.

enhancement
Dominant language
Java
Stars
4.6k
Forks
311
PR merge metrics
No merged PRs in 30d

Description

@Entity
class Session {
    @Id
    var id: Long = 0
    
    lateinit var messages: ToMany<Message>
}

In my app, there is a session list, we need to listen to the first of messages, but now I can't find any direct method to listen.

My question: Is there any simple workaround to listen?
BTW, now I need to add a extra field latestContent to solve this problem. Just as below.

@Entity
class Session {
    @Id
    var id: Long = 0

    //when update messages, update this field
    lateinit var latestContent: String
    
    lateinit var messages: ToMany<Message>
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.