You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current generator uses parameters to generate method names for queries, and doesn't take into account the query itself. This creates conflicts for situations where parameters and return types are the same, but queries are different.
This can be reproduced inside the sample, here's an example from UserDao:
@Query("SELECT * FROM UserEntity WHERE sampleAge < 18")
suspendfungetUnderageUsers(): List<UserEntity>
@Query("SELECT * FROM UserEntity WHERE sampleAge >= 18")
suspendfungetAdultUsers(): List<UserEntity>
@Query("SELECT * FROM UserEntity")
suspendfungetEntitiesReactive(): Flow<List<UserEntity>>
As you already noticed, all three methods call the same queryUserEntityByNoParameters, even if they have different queries.
The generated queryUserEntityByNoParameters looks like this:
Problem
The current generator uses parameters to generate method names for queries, and doesn't take into account the query itself. This creates conflicts for situations where parameters and return types are the same, but queries are different.
This can be reproduced inside the sample, here's an example from
UserDao
:The generated code looks like this:
As you already noticed, all three methods call the same
queryUserEntityByNoParameters
, even if they have different queries.The generated
queryUserEntityByNoParameters
looks like this:As we see, it's only related to
getUnderageUsers
, the other two queries were lost.Solution
Take into account the actual query when generating method names, using some kind of ID
The text was updated successfully, but these errors were encountered: