The GitHub Actions job "CI" on 
grails-core.git/fix/gorm-api-registration-scaling has succeeded.
Run started by GitHub user borinquenkid (triggered by borinquenkid).

Head commit for run:
0bfd35df3ef687a04f31530e4307e403a102cbc1 / Walter Duque de Estrada 
<[email protected]>
fix: restore TSM consistency for DATABASE and SCHEMA per-tenant sessions

Two bugs surfaced when lazy GORM API allocation was introduced for tenant
qualifiers:

1. DATABASE per-tenant: SQLErrorCodesFactory eagerly acquires a connection
   via DataSourceUtils during GrailsHibernateTemplate construction while a
   parent-transaction synchronisation is already active, binding the child
   DataSource to TSM.  The original executeWithNewSession code only unbound
   the DataSource when the SessionFactory was also bound, so the stale
   ConnectionHolder was still present when HibernateTransactionManager
   called doBegin, causing "Already value bound" for the child connection.
   Fix: decouple the DataSource unbind/rebind from the SessionFactory
   null-check so both are restored independently (hibernate5 + hibernate7).

2. SCHEMA per-tenant: addTenantForSchema re-creates a child datastore
   (new SessionFactory) on every test setup.  registerAllEntitiesWithEnhancer
   updated DATASTORES routing but not STATIC_APIS/INSTANCE_APIS/VALIDATION_APIS
   for non-eager schema qualifiers, leaving a stale API referencing the old
   SessionFactory.  The next withNewSession bound the new SF to TSM, but
   findStaticApi returned the cached API for the old SF, so
   getCurrentSession() found nothing.
   Fix: in GormEnhancer.registerEntity, evict the stale lazy-cached API
   entries for any qualifier that is not in apiQualifiers, forcing
   re-creation against the current datastore on next access.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

Report URL: https://github.com/apache/grails-core/actions/runs/28291670597

With regards,
GitHub Actions via GitBox

Reply via email to