I'm getting a strange error message: ```Caused by...
# exposed
g
I'm getting a strange error message:
Copy code
Caused by: java.lang.IllegalStateException: Can't init value outside the transaction
When using exposed in the spring integration flow handler. Everything works... The function that throws the exception:
Copy code
@Suppress("UNCHECKED_CAST")
    override fun getValue(thisRef: Any?, property: KProperty<*>): T? {
        val currentOrNullTransaction = TransactionManager.currentOrNull()
        return currentOrNullTransaction?.getUserData(key)
            ?: init?.let {
                val value = currentOrNullTransaction?.it() ?: error("Can't init value outside the transaction")
                currentOrNullTransaction.putUserData(key, value)
                value
            }
    }
Where the property is an
dao.EntityCache
but I'm not even using DAO classes. Just the DSL. Is some entity cache used when just using the DSL?
All this is triggered by some
EntityLifecycleInterceptor
, but (again) I do not have any DAO classes. Why would this be added as global inteceptor?
Also:
Copy code
TransactionSynchronizationManager.isActualTransactionActive()
return true.
Return whether there currently is an actual transaction active. This indicates whether the current thread is associated with an actual transaction rather than just with active transaction synchronization.
So I guess: 1. I don't understand why there is a global interceptor that does something with the
dao.EntityCache
2. Why does spring says that there is a current active transaction in the thread, but exposed says otherwise?
a
This is out of my depth, but... are you sure the Spring and Exposed transactions are compatible?