java - Derby doesn't allow isolation level to be set at TRANSACTION_SERIALIZABLE for concurrent access -
i'm using derby database , trying create db objects concurrently.
as know default isolation level in transaction_read_committed.
but don't want allow phantom reads db , hence, want set isolation level transaction_serializable.
all bit of code.
if(jdbctemplate.getdatasource().getconnection().gettransactionisolation() == connection.transaction_read_committed) { logger.info("the connection isolation transaction_read_committed"); } else { logger.info("please set connection isolation transaction_read_committed"); } jdbctemplate.getdatasource().getconnection().settransactionisolation(connection.transaction_serializable); if(jdbctemplate.getdatasource().getconnection().gettransactionisolation() == connection.transaction_serializable) { logger.info("the connection isolation transaction_serializable"); }
as expected, see log "the connection isolation transaction_read_committed", surprisingly dont see log "the connection isolation transaction_serializable".
also exception expecting occurs confirms isolation level not set serializable.
Comments
Post a Comment