You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the rawRowMapper and raw queries on PSQL, the boolean values are not mapped correctly, but when creating the query through query builder it works.
Create a Postgres database and a table with the following schema
CREATE TABLE test(
id SERIAL NOT NULL PRIMARY KEY,
is_enabled BOOLEAN NOT NULL DEFAULT TRUE
);
Create its connection source in code: i.e. val testServiceConnection: ConnectionSource? = JdbcConnectionSource(testServiceDBString, testServiceDBUser, testServiceDBPassword)
Create the model:
@DatabaseTable(tableName = "test")
data class Test(
@Generated
@DatabaseField(generatedId = true, columnName = "id")
var id: Int,
@DatabaseField(columnName = "is_enabled")
var isEnabled: Boolean
) {
private constructor() : this(
-1,
true
)
}
Insert two elements to the table, one true and one false
Create the DAO and two queries:
private val dao: Dao<Test, Int> =
DaoManager.createDao(ORMLiteConnections.testServiceDBORM, Test::class.java)
fun getAll(): List<Test> {
return userDao.queryBuilder().query()
}
fun getAllRaw(): List<Test> {
val returnList: MutableList<Test> = emptyMutableList()
userDao.queryRaw("SELECT * FROM test", dao.rawRowMapper).forEach { returnList.add(it) }
return returnList
}
Execute both and see that in the first one, the result is correct, but on the second one it is not
The text was updated successfully, but these errors were encountered:
Description
When using the rawRowMapper and raw queries on PSQL, the boolean values are not mapped correctly, but when creating the query through query builder it works.
Environment
OS: Ubuntu
IDE: IntellIJ
Language: Kotlin 1.4
OrmLite versions:
compile group: 'com.j256.ormlite', name: 'ormlite-core', version: '5.1'
compile group: 'com.j256.ormlite', name: 'ormlite-jdbc', version: '5.1'
DB connector: compile group: 'org.postgresql', name: 'postgresql', version: '9.3-1100-jdbc4'
How to reproduce
Create its connection source in code: i.e.
val testServiceConnection: ConnectionSource? = JdbcConnectionSource(testServiceDBString, testServiceDBUser, testServiceDBPassword)
Create the model:
Insert two elements to the table, one true and one false
Create the DAO and two queries:
The text was updated successfully, but these errors were encountered: