-
Notifications
You must be signed in to change notification settings - Fork 690
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
id not in record set #820
Comments
fixed in master |
Is there another way to access the inserted ID or should I wait for a new release or should I use an older version of exposed? |
It should be fixed since 0.23.1 |
I have the following code in version 0.25.1 and it doesn't work.
try {
transaction {
val userID = UserDAO.insert {
it[username] = user.username!!
it[email] = user.email!!
it[password] = user.password!!
it[verified] = user.verified!!
it[birthday] = user.birthday!!
} get UserDAO.id
// temp fix
// val userID = UserDAO.select { UserDAO.email eq (user.email!!) }.firstOrNull()?.get(UserDAO.id)
user.id = userID
}
} catch (e: Exception) {
// throws java.lang.IllegalStateException: ....dao.UserDAO."ID" is not in record set
throw Exception("User could not be inserted.")
}
object UserDAO : Table("user") {
val id: Column<Int> = integer("\"ID\"")
val username: Column<String> = varchar("username", 255)
val email: Column<String> = varchar("email", 255).uniqueIndex()
val password: Column<String> = varchar("password", 255)
val verified: Column<Boolean> = bool("verified")
val birthday: Column<DateTime> = date("birthday")
override val primaryKey = PrimaryKey(id)
} |
@infinityart , sorry but why do you expect to get id from a recordset where you don't set it and when id is not auto-generated column? |
@Tapac actually, the column "id" is specified as an auto-incremented column in the database. I use pgsql, the table type is "serial" and it uses the sequence "user_ID_seq". I have added |
@infinityart , could you try to remove quotes from id column name? |
New to Kotlin Exposed and trying to store data using IdTable and getting error 'id is not in record set.' Below is the code using
MySQL database is not able to save throws an error stating
Generated SQL Query
Please can anyone help me resolving the issue.
The text was updated successfully, but these errors were encountered: