Skip to content

Commit

Permalink
fix: change @transactional readOnly for select query
Browse files Browse the repository at this point in the history
  • Loading branch information
kihwankim committed May 19, 2024
1 parent 3735006 commit 04c8bf1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import org.springframework.data.support.PageableExecutionUtilsAdaptor
import org.springframework.transaction.annotation.Transactional
import kotlin.reflect.KClass

@Transactional
@NoRepositoryBean
@Transactional(readOnly = true)
@SinceJdsl("3.0.0")
open class KotlinJdslJpqlExecutorImpl(
private val entityManager: EntityManager,
Expand Down Expand Up @@ -145,6 +145,7 @@ open class KotlinJdslJpqlExecutorImpl(
return createSlice(query, query.returnType, pageable)
}

@Transactional
override fun <T : Any> update(
init: Jpql.() -> JpqlQueryable<UpdateQuery<T>>,
): Int {
Expand All @@ -161,6 +162,7 @@ open class KotlinJdslJpqlExecutorImpl(
return jpaQuery.executeUpdate()
}

@Transactional
override fun <T : Any, DSL : JpqlDsl> update(
dsl: DSL,
init: DSL.() -> JpqlQueryable<UpdateQuery<T>>,
Expand All @@ -171,12 +173,14 @@ open class KotlinJdslJpqlExecutorImpl(
return jpaQuery.executeUpdate()
}

@Transactional
override fun <T : Any> delete(
init: Jpql.() -> JpqlQueryable<DeleteQuery<T>>,
): Int {
return delete(Jpql, init)
}

@Transactional
override fun <T : Any, DSL : JpqlDsl> delete(
dsl: JpqlDsl.Constructor<DSL>,
init: DSL.() -> JpqlQueryable<DeleteQuery<T>>,
Expand All @@ -187,6 +191,7 @@ open class KotlinJdslJpqlExecutorImpl(
return jpaQuery.executeUpdate()
}

@Transactional
override fun <T : Any, DSL : JpqlDsl> delete(
dsl: DSL,
init: DSL.() -> JpqlQueryable<DeleteQuery<T>>,
Expand Down

0 comments on commit 04c8bf1

Please sign in to comment.