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
Query and query beans both have a method query.usingConnection(java.sql.Connection) ... so that is ok.
We should consider adding database.beginTransaction(connection) for the case where we have an external java.sql.Connection provided and want to use all Ebean functionality, not just queries.
Ebean has a method to turn a java.sql.Connection into a Transaction. Internally that is TransactionManager.wrapExternalConnection(Connection connection). Now, I thought that was exposed as public API but it is not.
We really should make the change to expose that method on Database. Something like:
// try with resourcestry (Transactiont = database.beginTransaction(connection)) {
// don't commit or rollback ... end() as a no-op
}
// as the connection is provided the expectation is that the // commit() / rollback() is also external code connection.commit();
This discussion was converted from issue #2232 on August 09, 2022 03:50.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Query and query beans both have a method query.usingConnection(java.sql.Connection) ... so that is ok.
We should consider adding
database.beginTransaction(connection)
for the case where we have an external java.sql.Connection provided and want to use all Ebean functionality, not just queries.Ebean has a method to turn a java.sql.Connection into a Transaction. Internally that is TransactionManager.wrapExternalConnection(Connection connection). Now, I thought that was exposed as public API but it is not.
We really should make the change to expose that method on Database. Something like:
Beta Was this translation helpful? Give feedback.
All reactions