Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
####################################################
I am experiencing an issue with updating a row in my Room database. The `updateDuration` method does not work as expected, and I receive a KSP-related error. The method is intended to update the `duration` and `duration_sync_status` fields in the database based on `device_id`, but the update does not take effect.
**Error Message:**
```
[ksp] java.lang.IllegalArgumentException: not a valid name: updateDuration-BRgCzHI
at com.squareup.javapoet.Util.checkArgument(Util.java:53)
at com.squareup.javapoet.MethodSpec$Builder.setName(MethodSpec.java:315)
at com.squareup.javapoet.MethodSpec$Builder.<init>(MethodSpec.java:310)
...
```
**Code:**
```kotlin
private const val TABLE_NAME = AlarmConstant.DB_ALARM_TABLE_NAME
@Dao
internal interface AlarmDao : DatabaseFactory.Room.BaseDao<AlarmEntity> {
@Query("UPDATE $TABLE_NAME SET duration = :duration AND duration_sync_status = :syncStatus WHERE device_id = :deviceId")
suspend fun updateDuration(
deviceId: AndroidDatabaseId,
duration: Duration,
syncStatus: SyncStatusHandler
): Int
}
```
**Steps to Reproduce:**
1. Define a Room entity for `AlarmEntity`.
2. Implement the `AlarmDao` interface with the `updateDuration` method.
3. Attempt to update a row using `updateDuration()`.
4. Observe that the update does not work, and an exception occurs.
**Expected Behavior:**
- The `updateDuration` method should update the `duration` and `duration_sync_status` fields in the database for the given `device_id`.
**Actual Behavior:**
- The method does not update the data, and an exception is thrown.
**Environment:**
- Android Studio Version: 2024.2.2
- Kotlin Version: 2.1.10
- Room Version: 2.7.0-alpha13
- KSP Version: 2.1.10-1.0.29
**Additional Information:**
- I have tried replacing `$TABLE_NAME` with a hardcoded string.
- I confirmed that the database is correctly initialized.
- The query structure has been verified, but the issue persists.
Any help or insights would be appreciated!
####################################################
Build: AI-242.23726.103.2422.12816248, 202412180503
AS: Ladybug Feature Drop | 2024.2.2
AI-242.23726.103.2422.12816248, JRE 21.0.4+-12508038-b607.1x64 JetBrains s.r.o., OS Windows 11(amd64) v10.0 , screens 2560x1440 (125%), 1920x1080 (100%)
Android Gradle Plugin: 8.8.0
Gradle: 8.12
Gradle JDK: Oracle OpenJDK 17.0.12
NDK: from local.properties: (not specified), latest from SDK: (not found)
CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
Source: send_feedback_icon```