Skip to content

HibernateJpaParametersParameterAccessor throws PersistenceException #2614

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

Closed
blue-hope opened this issue Aug 3, 2022 · 2 comments
Closed
Labels
status: invalid An issue that we don't feel is valid

Comments

@blue-hope
Copy link

blue-hope commented Aug 3, 2022

Related to #2370.

When executing query, below code is run before create query.

HibernateJpaParametersParameterAccessor(Parameters<?, ?> parameters, Object[] values, EntityManager em) {
  super(parameters, values);

  Session session = em.unwrap(Session.class);
  this.typeHelper = session.getSessionFactory().getTypeHelper();
}

Does it properly work on non-transactional query?
As you can see, It uses invoke() to unwrap Session but it throws IllegalStateException when the query is non transaction.
This is because it uses ThreadLocal Internally to get EntityManager and the ThreadLocal bindResource() which set the entityManager is called only when use transaction.
How can I fix it(or is it can be fixed)?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 3, 2022
@mp911de
Copy link
Member

mp911de commented Sep 19, 2022

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal sample that reproduces the problem. We require more contextual details to find out how you're using JPA.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Sep 19, 2022
@blue-hope
Copy link
Author

Ah, It occurs on spring 2.7.0, and upgrade it to 2.7.2 the error not occurs.

@mp911de mp911de added status: invalid An issue that we don't feel is valid and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants