JPilson Sumbo
05/21/2022, 2:03 PMjava.lang.IllegalStateException: com.assisuni.db.student.TableStudent.id is not in record set
The weird thing is that when checking the table,it shows the new record inserted even when an error was thrown during the insert operation
Has anyone faced the same issue
override suspend fun enrolStudentIntoSubject(subjectOfBatchId: Int, idOfStudent: Int): EnrolledSubjectModel? {
return try {
var statement:InsertStatement<Number>? = null
db.dbQuery {
statement = TableEnrolledSubjectStudent.insert {
it[batchSubjectId] = subjectOfBatchId // reference
it[studentId] = idOfStudent // reference to table student Id
}
}
statement?.resultedValues?.get(0)?.let {
exposedLogger.debug("Student $idOfStudent was Enrolled into subject of batch $subjectOfBatchId")
EnrolledSubjectModel.fromRow(it)
}
}catch (e:ExposedSQLException){
exposedLogger.debug("Failed to enrol student $idOfStudent to subject of batch $subjectOfBatchId")
throw e
}
}