Guest User

Untitled

a guest
Oct 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. public List<EducationEvent> findUnaddedEducationEvents(Student student, List<EducationModule> educationModules,
  2. Education education) {
  3. TypedQuery<EducationEvent> query = entityManager.createQuery(
  4. "select distinct ee from EducationEvent ee left join ee.limitedScopeEducations lse "
  5. + "where ee.educationModule in (:em) "
  6. + "and (ee.scope = :publicScope "
  7. + "or (ee.scope = :limitedScope and (ee.hostEducation = :education or :education in lse)) "
  8. + "or (ee.scope = :localScope and ee.hostEducation = :education)) "
  9. + "and ee.status = :status and ee.startDate > :now "
  10. + "and (ee.groupSize = 0 or (ee.groupSize > 0 "
  11. + " and ee.groupSize > (ee.numberOfStudents + ee.reservedSeats))) "
  12. + "and ee.id not in (select pee.educationEvent.id from PersonalEducationEvent pee "
  13. + "where studentStatus.student = :s and educationEvent.educationModule in (:em))",
  14. EducationEvent.class);
  15.  
  16. query.setParameter("s", student);
  17. query.setParameter("em", educationModules);
  18. query.setParameter("publicScope", PUBLIC);
  19. query.setParameter("limitedScope", LIMITED);
  20. query.setParameter("localScope", LOCAL);
  21. query.setParameter("education", education);
  22. query.setParameter("status", CONFIRMED);
  23. query.setParameter("now", new DateTime());
  24.  
  25. return query.getResultList();
  26.  
  27. 2017-10-19 14:46:32,673 [http-nio-8090-exec-10] WARN org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 42601
  28. 2017-10-19 14:46:32,674 [http-nio-8090-exec-10] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ERROR: syntax error at or near ")"
  29. Position: 1853
  30. lokakuuta 19, 2017 2:46:32 IP. org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver logException
  31. WARNING: Resolved exception caused by Handler execution: org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
  32.  
  33. Data access failure
  34.  
  35. Sorry, a problem occurred while accessing the database.
  36.  
  37. org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:384)
  38. org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:246)
  39. org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:491)
  40. org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
  41. org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
  42. org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
  43. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  44. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
  45. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
  46. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
  47. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  48. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
  49. com.sun.proxy.$Proxy435.findUnaddedEducationEvents(Unknown Source)
Add Comment
Please, Sign In to add comment