spring:
jpa:
properties:
hibernate:
connection:
provider_disables_autocommit: true
datasource:
hikari:
auto-commit: false
YAML
볡μ¬
default λ μμ λ°λμ΄λ€.
μμ μ€μ μ νμΈνλ κ³³μ
LogicalConnectionManagedImpl μ begin() μΈλ°,
initiallyAutoCommit = !doConnectionsFromProviderHaveAutoCommitDisabled() && determineInitialAutoCommitMode(getConnectionForTransactionManagement());
YAML
볡μ¬
!doConnectionsFromProviderHaveAutoCommitDisabled() μ΄ λΆλΆμ΄λ€.
μ μ€μ μ ν΄μ£Όμ§ μμΌλ©΄ provider_disables_autocommit=false κ° λκ³ ! μ°μ°μλ‘ μΈν΄ true κ° λλ€.
κ·Έλ¬λ©΄ getConnectionForTransactionManagement() λ©μλλ₯Ό μ€νμν€κ³ connection μ hikari pool μμ λ°μμ¨λ€.
μ΄λ κ² λλ©΄ νμ¬ μμ μμ service method λ₯Ό μ€νμν€μ§λ μμλλ° transaction interceptor μ μν΄ transaction μ μ΄λ©΄μ connection κΉμ§ λ¬Όκ² λλ€.
κ·Έλμ μμ μ€μ μ true λ‘ ν΄μ£Όλ©΄, doConnectionsFromProviderHaveAutoCommitDisabled() μ true κ° λκ³ ! μ°μ°μμ μν΄ false κ° λλ©΄μ getConnectionForTransactionManagement() λ μ€νμν€μ§ μμ connection μ μ΄ μμ μμ κ°μ Έμ€μ§ μλλ€.
κ·Έλ¬λ©΄ μ΄ κ²½μ° connection μ κ°μ Έκ°λ μμ μ?
β’
λͺ¨λ μ€λΉλ₯Ό λ§μΉκ³ StatementPreparerImpl μμ connection() μ νΈμΆν λ
β’
logicalConnection().getPhysicalConnection() νλ€. μ΄ λ acquireConnectionIfNeeded() μ΄ νΈμΆλκ³ μ΄ λ physical connection μ΄ null μ΄κΈ°λλ¬Έμ 물리μ 컀λ₯μ
μ νλνλ€.