-
Notifications
You must be signed in to change notification settings - Fork 37.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
NoResultException is not wrapped into EmptyResultDataAccessException #33088
Comments
It's a feature not bug. |
Where specifically is it not getting wrapped? We generally do wrap |
Yes, we invoke @Service
public class ServiceName implements IServiceName {
@PersistenceContext
EntityManager em;
@Transactional(readOnly = true)
@Override
public List<ISomeObject> findSomething(IParamObject param) {
Query q = em.createNamedQuery("QueryName");
q.setParameter("param", param);
return q.getResultList();
}
} In spring 4, exceptions were wrapped even when calling By registering the <bean id="persistenceExceptionTranslationPostProcessor"
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /> |
Generally, such a Not sure why this happened automatically for you with Spring 4. |
I added this:
to config file but errors show up:
I don't get why this change raises this error. Maybe a good solution is to use raw JPA exceptions. |
It looks like there is a circular reference between two of your services: In such a case, proxying might happen too late which is what that exception message says. Breaking a circular reference through a lazy reference is usually straightforward, so that e.g. "serviceName2" would use an |
Since the framework bits seem to work as intended here, I'm closing this issue. |
We upgraded spring from v4 to 6.0.22 and Hibernate from v4 to 6.4.9 and we spotted that
jakarta.persistence.NoResultException
is not wrapped intoEmptyResultDataAccessException
. This seems to be a bug.The text was updated successfully, but these errors were encountered: