door icon indicating copy to clipboard operation
door copied to clipboard

generated DAO selecting columns not specified

Open gonemad opened this issue 1 year ago • 0 comments

Query is set up to specific which columns to use

@Transaction
@Query("SELECT id, name, permissions, imageUrl FROM ProfileEntity")
abstract fun getAllEntitiesWithoutPin(): List<ProfileEntity>

Auto generated code references a column that is not in the query:

override fun getAllEntitiesWithoutPin(): List<ProfileEntity> =
      _db.prepareAndUseStatement(PreparedStatementConfig(
    sql = "SELECT id, name, permissions, imageUrl FROM ProfileEntity",
    readOnly = true,)
  ) { _stmt -> 
    _stmt.executeQuery().useResults{ _result -> 
      _result.mapRows {
        val _tmp_id = _result.getLong("id")
        val _tmp_name = _result.getString("name")
        val _tmp_permissions = _result.getString("permissions")
        val _tmp_imageUrl = _result.getString("imageUrl")
        val _tmp_pin = _result.getString("pin")
        ProfileEntity().apply {
          this.id = _tmp_id
          this.name = _tmp_name
          this.permissions = _tmp_permissions
          this.imageUrl = _tmp_imageUrl
          this.pin = _tmp_pin
        }
      }
    }
  }

gonemad avatar Feb 17 '24 02:02 gonemad