-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Provide StatelessSession for Panache #8348
Comments
/cc @FroMage @loicmathieu |
@maxandersen will also be interested in this :) |
I would like to get a clear set of use case where we would recommend people to use this alternative model. I am not sure detached entities plays that nicely with the Panache pattern. Sanne and I pulled our hair on a couple of related cases. So can we literally write the documentation that explains when to use which here and right now. Once we have that we can decide to push further. |
Good question..a JPA also offers view query (queries with
Queries with
But in compare to |
I think the question is wether its worth it for Panache to integrate with StatelessSession as opposed to just use stateless session directly ? |
Few examples to show the boilerplate code needed when using StatelessSession directly in compare to Panaches stateless CRUDs: Read operation:
instead of
Bulk delete operation:
instead of
Bulk insert operation:
instead of
|
This looks to me like you want a substitute of not only the Panache API but also the transactional interceptor and the CDI bit that allocates a new |
I agree with @FroMage this has nothing to do with Panache but directly to Hibernate ORM support. I would re-target this issue to Hibernate ORM extension. To implements this, we will need something close to what we try to do for readonly transaction (that are read only Hibernate sessions) in PR #7455 By the way, is a stateless session different from a read only session performance wise ? |
I wanted to have a layer over Hibernate/JPA (e.g., Panache API) which gives up some ORM overhead with the aim to have a (near) equal competitor (in regards to speed and memory consumption) for iBatis, jooq, This layer only uses on-board means of Hibernate/JPA/Quarkus (e.g., Stateless Session,..). Having such a layer could make the integration of iBatis, mybatis, jooq, etc. needless..
Also good questions, I don't know:) maybe @Sanne can answer it.. |
same as if you had two statelesssessions or two stateful session on same transaction - they would work in same transactional boundary but you risk some state in your objects to be out of sync. But that is not necessarily a bad thing; but my recommendatin would though to generally don't mix and match blindly ;) |
If StatelessSession is faster for read operation then it could be an alternative for #7455.
Now, I also think it is not worth to include a full support of StatelessSession patterns within Panache. The StatelessSession can be used directly and this should be sufficient. So I will close this issue.
If someone thinks it is worth to implement then feel free to open it again. |
Description
Actually, Panache retrieves its entities always with managed entity sessions.
Would be good if Panache has the possibility to query entities with
StatelessSession
because loading lots of data or doing bulk operations withStatelessSession
is better in terms of performance and memory consumption in compare to using no stateless session.See
Implementation ideas
Have something like
PanacheEntity.find(query, params).stateless().list()
.The text was updated successfully, but these errors were encountered: