I would like to integrate Kotlin Exposed into a Kotlin application that is already using Spring Data JPA. The problem I have is that only want to use one Transaction Manager for my application, but currently I have to have two (one for JPA and another for Exposed). Is there a way to only have one Transaction Manager?
Asked
Active
Viewed 631 times
-1
-
No longer trying to find an answer to this. I've decided to use jOOQ instead of Exposed. – Donald Jun 12 '20 at 12:40
1 Answers
0
I didn't work with kotlin-exposed
library before, but based on your question
,Just you have to create your own transaction-manager
bean. After that spring will use your bean, and you need to configure kotlin-exposed
to use it.
sample:
@Primary
@Bean("appTransactionManager")
fun appTransactionManager(
@Qualifier("appEntityManagerFactory") appEntityManagerFactory: LocalContainerEntityManagerFactoryBean
): PlatformTransactionManager {
return JpaTransactionManager(eccTransactionManager.getObject()!!)
}

Ibrahim AlTamimi
- 624
- 5
- 15