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

generated DAO selecting columns not specified #11

Open
gonemad opened this issue Feb 17, 2024 · 0 comments
Open

generated DAO selecting columns not specified #11

gonemad opened this issue Feb 17, 2024 · 0 comments

Comments

@gonemad
Copy link

gonemad commented Feb 17, 2024

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
        }
      }
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant