Skip to content
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

How to update a List of an object as field of entity into table in Floor #805

Open
ngminhkhoa opened this issue Feb 10, 2024 · 0 comments
Open

Comments

@ngminhkhoa
Copy link

ngminhkhoa commented Feb 10, 2024

I have below query to update and after I use cmd to generate file, I got error.
I don't know why but I used this query in Room Database and it's ok

ERROR

The parameter newUsersJoined should be referenced like a list (x IN (:newUsersJoined)) Change the type of newUsersJoined to not be a List<> orreference it with IN (:newUsersJoined) (including the parentheses).


QUERY

@Query('UPDATE spaces_table '
      'SET '
      'ownedBy = :newOwnedBy, '
      'secondUserId = CASE WHEN :newSecondUserId IS NOT NULL THEN :newSecondUserId ELSE secondUserId END, '
      'avatar = :newAvatar, '
      'name = :newName,'
      'username = CASE WHEN :newUsername IS NOT NULL THEN :newUsername ELSE username END, '
      'type = :newType, '
      'isTurnOffNotification = :newIsTurnOffNotification, '
      'usersJoined = :newUsersJoined '
      'WHERE id = :spaceId')
  Future<int?> updateSpace(
    String spaceId,
    String newOwnedBy,
    String newSecondUserId,
    String newAvatar,
    String newName,
    String newUsername,
    String newType,
    int newIsTurnOffNotification,
    List<UserJoinedEntity> newUsersJoined,
  );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant