I have a question while looking at the realm document.

Asked 2 years ago, Updated 2 years ago, 53 views

This is the 3rd question about reality. I don't finish it all at once, and there are a lot of things I don't know Please understand that I have a lot of questions because I am making ppt a little bit a week <

Kim Yong-wook answered well, so I'm posting a question here

This question is in the writing and question section of the realm document.

User user = new User("John");
user.setEmail("[email protected]");

// Copying an object to Realm. Any additional changes may be in realmUser.
realm.beginTransaction();
User realmUser = realm.copyToRealm(user);
realm.commitTransaction();

The top part is what the document says
What I'm saying is

realm.beginTransaction();
user = realm.copyToRealm(user);
realm.commitTransaction();


This is how you do it. Maybe... Is there an issue that we shouldn't do this because of the nature of Java?

2 [Question] - [Continuous question] I don't understand this part... <

At first, the document contained the following examples, so I understood that continuous queries mean that you get results through queries again.

RealmResults<User> teenagers = realm.where(User.class).between("age", 13, 20).findAll();
User firstJohn = teenagers.where().equalTo("name", "John").findFirst();

If you rewrite this, you can do this

User firstJohn = realm.where(User.class)
            .between("age", 13, 20)
`          `.findAll()
            .where()
`           `           .equalTo("name", "John")
            .findFirst();

I thought this is what continuous queries are like when you do findall and then where again. But it's hard because there's a different example right below...

RealmResults<User> teensWithPups = realm.where(User.class).between("age", 13, 20).equalTo("dogs.age", 1).findAll();

This wasn't an example of the form of doing findAll to get something about RealmResult and asking again.

But the problem is that the description just below says that continuous queries are based on RealmResults, not RealmQuery.

Um... I don't think you understand the point of the question, but just to ask you the point

What is a continuing query...?

Finally, looking at [Relationship] - [Connection Question], the continuous question I asked you in question 2 is chaning query and the connection question is link query, but is the connection question different from the continuous question?

realm

2022-09-21 18:48

1 Answers

I think number one is correct. Didn't you do it when you tested it?

// r1 => [U1,U2]
RealmResults<Person> r1 = realm.where(Person.class)
                             .equalTo("dogs.name", "Fluffy")
                             .equalTo("dogs.color", "Brown")
                             .findAll();

This is the link query that leads the query to another query.

// r2 => [U2]
RealmResults<Person> r2 = realm.where(Person.class)
                             .equalTo("dogs.name", "Fluffy")
                             .findAll()
                             .where()
                             .equalTo("dogs.color", "Brown")
                             .findAll();
                             .where()
                             .equalTo("dogs.color", "Yellow")
                             .findAll();

It is chain query that goes back to the query through where() in the result.

There was a mistake in the document, so I checked and gave feedback. And I'm thinking about changing the notation of consecutive queries to serial queries.

Can I have your email address for further feedback? If you send an email to [email protected], we will give you feedback again.


2022-09-21 18:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.