Closed ilgolf closed 9 months ago
The following is the revised sentence that I want.
After building the query, you can use RenderContext
to execute the query.
For example, you can use JpqlRenderContext
to execute the query:
val render = JpqlRenderer()
val context = JpqlRenderContext()
val rendered = render.render(query, context)
val jpaQuery: Query = entityManager.createQuery(rendered.query, query.returnType.java)
val result = jpaQuery.resultList
JpqlRender
is a class that renders the query as String.
his class extracts the query and parameters from the RenderContext
and renders them as String.
RenderContext
has elements for rendering the query as String.
Kotlin JDSL provides JpqlRenderContext
as the default RenderContext
for the JPQL.
Creating RenderContext
is expensive, so the Kotlin JDSL recommends creating it once and reusing it afterward.
Since RenderContext
is immutable, you can access RenderContext
from multiple threads.
if you want to use Kotlin JDSL comfatable with Spring Data JPA or Spring Batch, please see Spring Support.
Hi ilgolf. Thank you for your interest in Kotlin JDSL.
I like the way you've written it - it shows how to execute the query, but also explains the core components that Kotlin JDSL provides.
I will update the documentation today based on what you wrote!
I've added the content to the docs, if there's anything else you'd like to see added, please open a new issue or reopen this issue.
Background
I am using Kotlin JDSL for the first time and find that the documentation could be clearer in its explanation. Therefore, I want to modify and improve the clarity of this particular section.
Object
improve the clarity of this particular section.
Benefits
The description of "Execute the query section" is clearer, so users can easily follow it.