SQL Server Transaction Management über Springboot 3 und Hibernate 6Java

Java-Forum
Anonymous
 SQL Server Transaction Management über Springboot 3 und Hibernate 6

Post by Anonymous »

Ich bewege eine alte Java Springboot-Base-Anwendung von Version 2.x.x auf die neuesten v3.4.2 . An Jakarta ee < /li>
< /ul>
Zusätzlich verwendet die Anwendung (die bereits in der Produktionsumgebung ausgeführt wird) den SQLSERVER SP_GetAPLOCK < /code> gespeicherte Verfahren zur Durchführung einiger Sperren zur Laufzeit. Ich habe diese gespeicherte Prozedur in einem anderen eingeschlossen, nur um den zurückgegebenen Statuscode zu verwalten, Definition unten: < /p>

Code: Select all

CREATE PROCEDURE sp_getapplock_wrapper @Resource NVARCHAR(255), @LockMode NVARCHAR(32), @LockTimeout as INT, @Result INT OUTPUT
AS
BEGIN
EXEC @Result = Sp_getapplock @Resource = @Resource, @LockMode = @LockMode, @LockTimeout = @LockTimeout;
END;
< /code>
Nach dem Anwendungsaktualisierung wird ein Aufruf zu diesem gespeicherten Prozedur ein -999 < /code> Fehlercode zurückgegeben, der verhindert, dass die Datenbank gesperrt wird. Die Transaktion ist sowohl auf Java als auch auf der Datenbankseite korrekt geöffnet: < /p>
[nio-8081-exec-1] o.s.orm.jpa.JpaTransactionManager        : Creating new transaction with name [com.extoxesses.poc.core.service.CoreService.startProcess]: PROPAGATION_REQUIRED,ISOLATION_SERIALIZABLE
[nio-8081-exec-1] .i.SessionFactoryImpl$SessionBuilderImpl : Opening Hibernate Session.  tenant=null
[nio-8081-exec-1] o.h.r.j.i.LogicalConnectionManagedImpl   : `hibernate.connection.provider_disables_autocommit` was enabled.  This setting should only be enabled when you are certain that the Connections given to Hibernate by the ConnectionProvider have auto-commit disabled.   Enabling this setting when the Connections do not have auto-commit disabled will lead to Hibernate executing SQL operations outside of any JDBC/SQL transaction.
[nio-8081-exec-1] org.hibernate.internal.SessionImpl       : Opened Session [42330797-b6ac-4444-b8ed-edddb2d47029] at timestamp: 1740480200789
[nio-8081-exec-1] o.s.orm.jpa.JpaTransactionManager        : Opened new EntityManager [SessionImpl(4729152PersistenceContext[entityKeys=[], collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
[nio-8081-exec-1] o.h.e.t.internal.TransactionImpl         : On TransactionImpl creation, JpaCompliance#isJpaTransactionComplianceEnabled == false
[nio-8081-exec-1] o.h.e.t.internal.TransactionImpl         : begin
[nio-8081-exec-1] cResourceLocalTransactionCoordinatorImpl : ResourceLocalTransactionCoordinatorImpl#afterBeginCallback
[nio-8081-exec-1] o.s.orm.jpa.JpaTransactionManager        : Exposing JPA transaction as JDBC [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@71b08367]
< /code>
Die gespeicherte Prozedurinvokation ist korrekt: < /p>
[nio-8081-exec-1] c.e.poc.core.service.LockService         : Acquiring lock for id id
[nio-8081-exec-1] o.h.p.internal.ProcedureCallImpl         : Preparing procedure call : org.hibernate.sql.exec.internal.JdbcCallImpl@3b078a57
[nio-8081-exec-1] org.hibernate.SQL                        :
{call sp_getapplock_wrapper(?, ?, ?, ?)}
Hibernate:
{call sp_getapplock_wrapper(?, ?, ?, ?)}
[nio-8081-exec-1] o.h.r.j.i.ResourceRegistryStandardImpl   : Registering statement [HikariProxyCallableStatement@1877695894 wrapping sp_executesql SQL: null]
[nio-8081-exec-1] org.hibernate.orm.jdbc.bind              : binding parameter (1:VARCHAR)

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post