Gustav Elmgren
12/16/2022, 12:05 PMCaused 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:
@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?Gustav Elmgren
12/16/2022, 12:17 PMEntityLifecycleInterceptor
, but (again) I do not have any DAO classes. Why would this be added as global inteceptor?Gustav Elmgren
12/16/2022, 12:44 PMTransactionSynchronizationManager.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?Andrew O'Hara
12/16/2022, 3:42 PM