Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-708] change @Transactional readOnly for select query #710

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import javax.persistence.Query
import javax.persistence.TypedQuery
import kotlin.reflect.KClass

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

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

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

@Transactional
override fun <T : Any, DSL : JpqlDsl> update(
dsl: DSL,
init: DSL.() -> JpqlQueryable<UpdateQuery<T>>,
Expand All @@ -169,12 +172,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 @@ -185,6 +190,7 @@ open class KotlinJdslJpqlExecutorImpl(
return jpaQuery.executeUpdate()
}

@Transactional
override fun <T : Any, DSL : JpqlDsl> delete(
dsl: DSL,
init: DSL.() -> JpqlQueryable<DeleteQuery<T>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import org.springframework.data.support.PageableExecutionUtilsAdaptor
import org.springframework.transaction.annotation.Transactional
import kotlin.reflect.KClass

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

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

@Transactional
override fun <T : Any, DSL : JpqlDsl> update(
dsl: JpqlDsl.Constructor<DSL>,
init: DSL.() -> JpqlQueryable<UpdateQuery<T>>,
Expand All @@ -161,6 +163,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 +174,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 +192,7 @@ open class KotlinJdslJpqlExecutorImpl(
return jpaQuery.executeUpdate()
}

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