Skip to content

Collection not being reachable when call a custom query inside a @Transactional method (Spring-Data-Couchbase 5.0.0-M6) #1569

Closed
@PRodrigues-eb

Description

@PRodrigues-eb

On our repository classes we have the following query methods:

public interface AccountRepository extends CouchbaseRepository<ClientOperationsAccount, String> {

    Optional<ClientOperationsAccount> findBySalesforceId(String salesforceId);
    
    Optional<ClientOperationsAccount> findByEnterpriseAccountId(String enterpriseAccountId);
}

If we call any of them outside a @transactional method it works well, but if it be called inside a @transactional method we got the following error:

Keyspace not found in CB datastore: default:client-operations-account - cause: No bucket named client-operations-account

Seems that it's not pointing to the configured bucket and scope when it is called inside a @transactional method, interestingly it only happen to custom query methods.

Exception:

Caused by: org.springframework.data.couchbase.transaction.error.TransactionSystemUnambiguousException: Transaction has failed with cause 'com.couchbase.client.core.error.IndexFailureException: The server reported an issue with the underlying index {"completed":true,"coreId":"0xb8671a600000001","errors":[{"code":12003,"message":"Keyspace not found in CB datastore: default:client-operations-account - cause: No bucket named client-operations-account","retry":false}],"httpStatus":500,"idempotent":false,"lastDispatchedFrom":"127.0.0.1:56741","lastDispatchedTo":"localhost:8093","requestId":124,"requestType":"QueryRequest","retried":0,"service":{"operationId":"query","statement":"SELECT `_class`, META(`client-operations-account`).`id` AS __id, `enterpriseAccountId`, `salesforceId`, `bullhornId`, `accountName`, `businessType`, `currentServiceLevel`, `accountDescription`, `industry`, `inheritedAccount`, `invoiceName`, `accountActivatedDate`, `legacyId`, `accountParentId`, `website`, `wmbeAccount`, `shippingAddress`, `accountBranch`, `accountBrand`, `accountFinancials`, `accountSetup`, `brandSpecificRollups`, META(`client-operations-account`).`cas` AS __cas, `createdAt`, `updatedAt`, `createdBy`, `updatedBy` FROM `client-operations-account` WHERE `_class` = \"com.employbridge.account.manager.model.ClientOperationsAccount\" AND `enterpriseAccountId` = $1","target":"NodeIdentifier{address=localhost, managerPort=8091}","type":"query"},"timeoutMs":25993,"timings":{"dispatchMicros":54512,"totalDispatchMicros":54512,"totalMicros":55329}}'
	at org.springframework.data.couchbase.transaction.CouchbaseCallbackTransactionManager.convert(CouchbaseCallbackTransactionManager.java:139)
	at org.springframework.data.couchbase.transaction.CouchbaseCallbackTransactionManager.executeNewTransaction(CouchbaseCallbackTransactionManager.java:130)
	at org.springframework.data.couchbase.transaction.CouchbaseCallbackTransactionManager.execute(CouchbaseCallbackTransactionManager.java:83)
	at org.springframework.data.couchbase.transaction.CouchbaseTransactionInterceptor.invokeWithinTransaction(CouchbaseTransactionInterceptor.java:81)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:755)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:706)
	at com.employbridge.account.manager.service.impl.ClientOperationsAccountServiceImpl$$SpringCGLIB$$0.update(<generated>)
	at com.employbridge.account.manager.kafka.SalesforceAccountListener.tryToUpdateAccount(SalesforceAccountListener.java:146)
	... 55 common frames omitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions