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
DatabaseEnginePool contains a pool of DatabaseEngine. However, each of these Database Engines may have different entities and prepared statements in memory if we don't propagate the entities and prepared statements to all DatabaseEngines in the pool.
To deal with this, every time that I do a DatabaseEnginePool#borrow I need to do a DatabaseEngine#loadEntity if I want to persist an entity. Otherwise, doing a DatabaseEngine#persist will throw an exception if the entity on that DatabaseEngine wasn't loaded yet.
In relation to the prepared statements, every time I do a DatabaseEnginePool#borrow to do an operation using a prepared statement (e.g. DatabaseEngine#executePSUpdate), I need to perform a check to see if a prepared statement exists or create it (DatabaseEngine#preparedStatementExists and DatabaseEngine#createPreparedStatement).
Can we have a way to set the entities and prepared statements globally inside the DatabaseEnginePool and use that on every DatabaseEngine from the pool? At the moment, we can use a Function on the DatabaseEnginePool#getConnectionPool to run some action on the DatabaseEngines returned from the pool where we could register the prepared statements and entities but this needs to be done when we create the DatabaseEnginePool and not after. Hence, it would require information to be passed outside of the scope where the pool will be necessary. IMO we should be able to update the context associated with the DatabaseEngines that exist in the pool, even after the pool is created. This prevents leakage of information from classes using DatabaseEngines from the pool.
The text was updated successfully, but these errors were encountered:
DatabaseEnginePool
contains a pool ofDatabaseEngine
. However, each of these Database Engines may have different entities and prepared statements in memory if we don't propagate the entities and prepared statements to allDatabaseEngine
s in the pool.To deal with this, every time that I do a
DatabaseEnginePool#borrow
I need to do aDatabaseEngine#loadEntity
if I want to persist an entity. Otherwise, doing a DatabaseEngine#persist will throw an exception if the entity on thatDatabaseEngine
wasn't loaded yet.In relation to the prepared statements, every time I do a DatabaseEnginePool#borrow to do an operation using a prepared statement (e.g. DatabaseEngine#executePSUpdate), I need to perform a check to see if a prepared statement exists or create it (DatabaseEngine#preparedStatementExists and DatabaseEngine#createPreparedStatement).
Can we have a way to set the entities and prepared statements globally inside the
DatabaseEnginePool
and use that on everyDatabaseEngine
from the pool? At the moment, we can use a Function on theDatabaseEnginePool#getConnectionPool
to run some action on theDatabaseEngine
s returned from the pool where we could register the prepared statements and entities but this needs to be done when we create the DatabaseEnginePool and not after. Hence, it would require information to be passed outside of the scope where the pool will be necessary. IMO we should be able to update the context associated with theDatabaseEngine
s that exist in the pool, even after the pool is created. This prevents leakage of information from classes usingDatabaseEngine
s from the pool.The text was updated successfully, but these errors were encountered: