org.springframework.orm.jpa.JpaSystemException: nested exception is javax.persistence.PersistenceException

Stack Overflow | Pavanraotk | 1 week ago
  1. 0

    After migrating Spring Data application from Gosling-SR4 to Hopper-SR1 release, all custom queries that extends JpaRepository throws the following message: {code:java} Caused by: java.lang.IllegalStateException: No aliases found in result tuple! Make sure your query defines aliases! at org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter.convert(AbstractJpaQuery.java:246) [spring-data-jpa-1.10.1.RELEASE.jar:] at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:185) [spring-data-commons-1.12.1.RELEASE.jar:] at org.springframework.data.repository.query.ResultProcessor$ChainingConverter$1.convert(ResultProcessor.java:173) [spring-data-commons-1.12.1.RELEASE.jar:] at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:185) [spring-data-commons-1.12.1.RELEASE.jar:] at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:142) [spring-data-commons-1.12.1.RELEASE.jar:] at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:107) [spring-data-jpa-1.10.1.RELEASE.jar:] at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:92) [spring-data-jpa-1.10.1.RELEASE.jar:] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) [spring-data-commons-1.12.1.RELEASE.jar:] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) [spring-data-commons-1.12.1.RELEASE.jar:] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE] ... 113 more {code} {code:java} public interface UserProfileAccessGroupRepository extends JpaRepository<UserProfileAccessGroup, UserProfileAccessGroupPK> { @Modifying @Query("DELETE FROM UserProfileAccessGroup upag WHERE upag.id.accessGroup = ?1") public void deleteByAccessGroup(AccessGroup accessGroup); @Modifying @Query("DELETE FROM UserProfileAccessGroup upag WHERE upag.id.userProfile = ?1") public void deleteByUserProfile(UserProfile userProfile); @Query("SELECT upag.id.accessGroup FROM UserProfileAccessGroup upag WHERE upag.id.userProfile = ?1") public List<AccessGroup> findAccessGroupByUserProfile(UserProfile userProfile); @Query("SELECT upag.id.accessGroup FROM UserProfileAccessGroup upag WHERE upag.id.userProfile = ?1 AND upag.id.accessGroup.functionality = false") public List<AccessGroup> findGroupByUserProfile(UserProfile userProfile); public List<UserProfileAccessGroup> findByExpirationDateBefore(Date date); } {code} {code:java} @Entity public class UserProfileAccessGroup implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId private UserProfileAccessGroupPK id; private Date expirationDate; @ManyToOne @JoinColumn(name = "authorizedBy") private UserProfile authorizedBy; public UserProfileAccessGroupPK getId() { if (id == null) { id = new UserProfileAccessGroupPK(); } return id; } public void setId(UserProfileAccessGroupPK id) { this.id = id; } public Date getExpirationDate() { return expirationDate; } public void setExpirationDate(Date expirationDate) { this.expirationDate = expirationDate; } public UserProfile getAuthorizedBy() { return authorizedBy; } public void setAuthorizedBy(UserProfile authorizedBy) { this.authorizedBy = authorizedBy; } @Embeddable public static class UserProfileAccessGroupPK implements Serializable { private static final long serialVersionUID = 1L; @ManyToOne @JoinColumn(name = "accessGroupId") private AccessGroup accessGroup; @ManyToOne @JoinColumn(name = "userProfileId") private UserProfile userProfile; public UserProfileAccessGroupPK() { } public UserProfileAccessGroupPK(AccessGroup accessGroup, UserProfile userProfile) { this.accessGroup = accessGroup; this.userProfile = userProfile; } public AccessGroup getAccessGroup() { return accessGroup; } public void setAccessGroup(AccessGroup accessGroup) { this.accessGroup = accessGroup; } public UserProfile getUserProfile() { return userProfile; } public void setUserProfile(UserProfile userProfile) { this.userProfile = userProfile; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((accessGroup == null) ? 0 : accessGroup.hashCode()); result = prime * result + ((userProfile == null) ? 0 : userProfile.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; UserProfileAccessGroupPK other = (UserProfileAccessGroupPK) obj; if (accessGroup == null) { if (other.accessGroup != null) return false; } else if (!accessGroup.equals(other.accessGroup)) return false; if (userProfile == null) { if (other.userProfile != null) return false; } else if (!userProfile.equals(other.userProfile)) return false; return true; } } } {code}

    Spring JIRA | 9 months ago | ofbiz
    org.springframework.dao.InvalidDataAccessApiUsageException: No aliases found in result tuple! Make sure your query defines aliases!; nested exception is java.lang.IllegalStateException: No aliases found in result tuple! Make sure your query defines aliases!
  2. 0

    org.springframework.dao.InvalidDataAccessApiUsageException: No value for key [org.hibernate.jpa.internal.EntityManagerImpl

    Stack Overflow | 6 months ago | melad
    org.springframework.dao.InvalidDataAccessApiUsageException: No value for key [org.hibernate.jpa.internal.EntityManagerImpl@2b99335] bound to thread [service-catalina-exec-16]; nested exception is java.lang.IllegalStateException: No value for key [org.hibernate.jpa.internal.EntityManagerImpl@2b99335] bound to thread [service-catalina-exec-16]
  3. 0

    JPA compound key with foreign key and enum

    Stack Overflow | 2 years ago
    org.springframework.orm.jpa.JpaSystemException: org.hibernate.id.IdentifierGenerationException: null id generated for:class something.persistence.entity.message.MessageDesc; nested exception is javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: null id generated for:class something.persistence.entity.message.MessageDesc
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to resolve an IllegalStateException: User not found in JUnit test?

    Stack Overflow | 6 months ago | poseid
    org.springframework.dao.InvalidDataAccessApiUsageException: User not found!; nested exception is java.lang.IllegalStateException: User not found!
  6. 0

    spring-boot-jpa unable to persist entity with multiple foreign keys

    Stack Overflow | 2 years ago | Kleber Mota
    org.springframework.orm.jpa.JpaSystemException: Error while committing the transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.persistence.PersistenceException

      null

      at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert()
    2. org.hibernate.jpa
      QueryImpl.getSingleResult
      1. org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)
      2. org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
      3. org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:560)
      3 frames
    3. Spring Data JPA
      AbstractJpaQuery.execute
      1. org.springframework.data.jpa.repository.query.JpaQueryExecution$SingleEntityExecution.doExecute(JpaQueryExecution.java:206)
      2. org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:78)
      3. org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:100)
      4. org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:91)
      4 frames
    4. Spring Data Core
      RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:462)
      2. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:440)
      2 frames
    5. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      1 frame
    6. org.springframework.data
      DefaultMethodInvokingMethodInterceptor.invoke
      1. org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
      1 frame
    7. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      1 frame
    8. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      2. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
      3. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      3 frames
    9. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      1 frame
    10. Spring Tx
      PersistenceExceptionTranslationInterceptor.invoke
      1. org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
      1 frame
    11. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      1 frame
    12. Spring Data JPA
      CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke
      1. org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:131)
      1 frame
    13. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      2. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      4. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
      4 frames
    14. com.sun.proxy
      $Proxy163.findByTransferStatusAndServiceRequestId
      1. com.sun.proxy.$Proxy163.findByTransferStatusAndServiceRequestId(Unknown Source)
      1 frame
    15. com.comviva.mfs
      MoneyService$$FastClassBySpringCGLIB$$86b826b0.invoke
      1. com.comviva.mfs.txn.money.action.CheckIfTransactionAlreadyCompletedAction.execute(CheckIfTransactionAlreadyCompletedAction.java:44)
      2. com.comviva.mfs.workflow.engine.StepExecutor.execute(StepExecutor.java:127)
      3. com.comviva.mfs.workflow.engine.StepExecutor.execute(StepExecutor.java:77)
      4. com.comviva.mfs.workflow.engine.StepExecutor.execute(StepExecutor.java:46)
      5. com.comviva.mfs.workflow.engine.WorkflowEngine.execute(WorkflowEngine.java:41)
      6. com.comviva.mfs.workflow.engine.WorkflowEngine.execute(WorkflowEngine.java:45)
      7. com.comviva.mfs.workflow.engine.WorkflowEngine.execute(WorkflowEngine.java:25)
      8. com.comviva.mfs.txn.money.service.MoneyService.handleAmbiguousTransaction(MoneyService.java:102)
      9. com.comviva.mfs.txn.money.service.MoneyService$$FastClassBySpringCGLIB$$86b826b0.invoke(<generated>)
      9 frames
    16. Spring Core
      MethodProxy.invoke
      1. org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      1 frame
    17. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      2 frames
    18. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      2. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
      3. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      3 frames
    19. Spring AOP
      CglibAopProxy$DynamicAdvisedInterceptor.intercept
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      2. org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
      2 frames
    20. com.comviva.mfs
      MoneyServiceListener$$FastClassBySpringCGLIB$$ba559f84.invoke
      1. com.comviva.mfs.txn.money.service.MoneyService$$EnhancerBySpringCGLIB$$567e88a5.handleAmbiguousTransaction(<generated>)
      2. com.comviva.mfs.txn.money.service.MoneyServiceListener.handleAmbiguousTransaction(MoneyServiceListener.java:140)
      3. com.comviva.mfs.txn.money.service.MoneyServiceListener$$FastClassBySpringCGLIB$$ba559f84.invoke(<generated>)
      3 frames
    21. Spring Core
      MethodProxy.invoke
      1. org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      1 frame
    22. Spring AOP
      MethodInvocationProceedingJoinPoint.proceed
      1. org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      3. org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
      3 frames
    23. com.comviva.mfs
      ServiceFlowStepInterceptor.invoke
      1. com.comviva.mfs.common.serviceflow.ServiceFlowStepInterceptor.invoke(ServiceFlowStepInterceptor.java:51)
      1 frame
    24. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    25. Spring AOP
      MethodInvocationProceedingJoinPoint.proceed
      1. org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620)
      2. org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609)
      3. org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
      4. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
      5. org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
      5 frames
    26. com.comviva.mfs
      MetricsInterceptor.invoke
      1. com.comviva.mfs.common.serviceflow.MetricsInterceptor.invoke(MetricsInterceptor.java:62)
      1 frame
    27. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    28. Spring AOP
      CglibAopProxy$DynamicAdvisedInterceptor.intercept
      1. org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620)
      2. org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609)
      3. org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
      4. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
      5. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
      6. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      7. org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
      7 frames
    29. com.comviva.mfs
      MoneyServiceListener$$EnhancerBySpringCGLIB$$84aea6e3.handleAmbiguousTransaction
      1. com.comviva.mfs.txn.money.service.MoneyServiceListener$$EnhancerBySpringCGLIB$$84aea6e3.handleAmbiguousTransaction(<generated>)
      1 frame
    30. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    31. Spring Core
      MethodInvoker.invoke
      1. org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
      1 frame
    32. Spring RabbitMQ Support
      SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run
      1. org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:387)
      2. org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:298)
      3. org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:757)
      4. org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:680)
      5. org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:93)
      6. org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:183)
      7. org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1358)
      8. org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:661)
      9. org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1102)
      10. org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1086)
      11. org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1100(SimpleMessageListenerContainer.java:93)
      12. org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1203)
      12 frames
    33. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)
      1 frame