You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we are upgrading to Micronaut 2.x and we are having some issue on our data layer when using javax.transaction.Transactional annotation. We have two data sources on application.yml one for read only operations and one for read and write.
Our repos are annotated with io.micronaut.data.jdbc.annotation.JdbcRepository and also io.micronaut.data.annotation.Repository (with the name of the data source).
@Repository("main")
@JdbcRepository(dialect = Dialect.POSTGRES)
public abstract class ReadWriterRepository
{
@Transactional
public Entity upsert(
Entity entity) {
...
}
The issue is when we can the method (upsert) annotaed with javax.transaction.Transactional and we are getting : "Multiple possible bean candidates found: [io.micronaut.transaction.jdbc.DataSourceTransactionManager, io.micronaut.transaction.jdbc.DataSourceTransactionManager]" . I was wondening if anyone has encoured the same issue and how to fix it? is there any incomatibility with micronaut data (1.1.1) and Micornaut 2.x?
When we debug in DefaultBeanContext.findConcreteCandidate there are two beans one for "ready-only" data source and one for "main" data source. before upgrading to Micronaut 2.x the data sources was automatically picked up by io.micronaut.data.annotation.Repository("data-source-name"). and the transactional manager was automatically resolved to the correct bean
The text was updated successfully, but these errors were encountered:
Based on the code that debuggged and followed - For each Datasource, a DataSourceTrasansactionManager Bean is created. However it is not directly associated with the Datasource. Thus while@Repository is able to specify the datasource to use, it still finds 2 beans of DataSourceTrasansactionManager in the context. Using transaction advice, allows you to specify the transaciton manager to use.
To add - the Interceptor seems to look for TransactionAdvice on the method. Although the annotation itself can be applied on class, anything applied on class is not checked currnetly. Perhaps it is by design.
Hi, we are upgrading to Micronaut 2.x and we are having some issue on our data layer when using javax.transaction.Transactional annotation. We have two data sources on application.yml one for read only operations and one for read and write.
Our repos are annotated with io.micronaut.data.jdbc.annotation.JdbcRepository and also io.micronaut.data.annotation.Repository (with the name of the data source).
and
The issue is when we can the method (upsert) annotaed with javax.transaction.Transactional and we are getting : "Multiple possible bean candidates found: [io.micronaut.transaction.jdbc.DataSourceTransactionManager, io.micronaut.transaction.jdbc.DataSourceTransactionManager]" . I was wondening if anyone has encoured the same issue and how to fix it? is there any incomatibility with micronaut data (1.1.1) and Micornaut 2.x?
When we debug in DefaultBeanContext.findConcreteCandidate there are two beans one for "ready-only" data source and one for "main" data source. before upgrading to Micronaut 2.x the data sources was automatically picked up by io.micronaut.data.annotation.Repository("data-source-name"). and the transactional manager was automatically resolved to the correct bean
The text was updated successfully, but these errors were encountered: