val dbConnection = PgConnection.create("jdbc:postgresql://localhost:5432/mydb")
val transaction = dbConnection.createTransaction()
update(TestEntity).set(
TestEntity.name, "BLEH ${Random().nextInt()}"
).where(TestEntity.id eq 1).executeOn(transaction)
transaction.commit()
This causes a postgres error:
Cannot commit when autoCommit is enabled.
C3P0, Hikari and regular JDBC allows you to turn off autocommit on the connection itself.
Where would be a reasonable place to add such a property, on PgConnection and its parent classes themselves?
val dbConnection = PgConnection.create(
"jdbc:postgresql://localhost:5432/mydb",
ConnectionOptions(autoCommit = false
))
The workaround for now is to switch off autocommit on the DB level which is not always an option when using a DB hosted by someone else.
This causes a postgres error:
C3P0, Hikari and regular JDBC allows you to turn off autocommit on the connection itself.
Where would be a reasonable place to add such a property, on PgConnection and its parent classes themselves?
The workaround for now is to switch off autocommit on the DB level which is not always an option when using a DB hosted by someone else.