title: util.PSQLException: ERROR: column does not exist (problems with LEFT JOIN and @Formula)
body: <p>I am writing <code>MVC</code> <code>Rest</code> online store. I use <code>Spring Boot</code>, <code>Hibernate</code> and <code>PostgreSQL</code> in my project. I have drinks and want to be able to sort them when I receive them. Everything works fine, the only thing I want to do is to take drinks if the order status is active. To do this, I added a <code>left join</code> query to my <code>sql</code>, and check it in the <code>PostgreSQL</code> console, everything worked. Only those drinks that were in the order with the active status were displayed. But if I throw the same <code>sql</code> query into <em>@Formula</em>, then an error is displayed. What could be the problem, and how do you use it?</p>
  <p>My database schema:</p>
  <p><a href="https://i.stack.imgur.com/Zre35.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zre35.png" alt="enter image description here" /></a></p>
  <p>Drink class with @FORMULA:</p>
  <pre class="lang-java prettyprint-override"><code>@Data
  @Entity
  @NoArgsConstructor
  @Table(name = &quot;drink&quot;)
  @Inheritance(strategy = InheritanceType.JOINED)
  public class Drink {
  
      @Id
      @GeneratedValue
      private Long id;
  
      private String name;
  
      private BigDecimal price;
  
      /**
       * Drinks count in cart
       */
      @Formula(&quot;coalesce((select sum(c.count) from cart_items c&quot; +
              &quot; left join pg_order po on c.order_id = po.id&quot; +
              &quot; where order_status = 'ACTIVE' and\n&quot; +
              &quot;c.drink_id = id), 0)&quot;)
      private Long drinkCountInOrder;
  
      private String about;
  
      private int weight;
  
      @Column(name = &quot;is_deleted&quot;)
      private boolean isDeleted;
  
      @ManyToOne
      @JoinColumn(name = &quot;packaging_id&quot;)
      private Packaging packaging;
  
      @ManyToOne
      @JoinColumn(name = &quot;manufacturer_id&quot;)
      private Manufacturer manufacturer;
  
      @ManyToOne
      @JoinColumn(name = &quot;country_id&quot;)
      private Country country;
  
      @Override
      public boolean equals(Object o) {
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          Drink drink = (Drink) o;
          return isDeleted == drink.isDeleted &amp;&amp;
                  Objects.equals(id, drink.id) &amp;&amp;
                  Objects.equals(name, drink.name) &amp;&amp;
                  Objects.equals(price, drink.price) &amp;&amp;
                  Objects.equals(about, drink.about) &amp;&amp;
                  Objects.equals(packaging, drink.packaging) &amp;&amp;
                  Objects.equals(manufacturer, drink.manufacturer) &amp;&amp;
                  Objects.equals(country, drink.country);
      }
  
      @Override
      public int hashCode() {
          return Objects.hash(id, name, price, about, isDeleted, packaging, manufacturer, country);
      }
  }
  </code></pre>
  <p>Coffee class extends Drink:</p>
  <pre class="lang-java prettyprint-override"><code>@Setter
  @Entity
  @Table(name = &quot;coffee&quot;)
  public class Coffee extends Drink {
  
      @ManyToOne
      @JoinColumn(name = &quot;type_id&quot;)
      private CoffeeType coffeeType;
  
      @ManyToOne
      @JoinColumn(name = &quot;roasting_id&quot;)
      private Roasting roasting;
  }
  </code></pre>
  <p>Order class:</p>
  <pre class="lang-java prettyprint-override"><code>@Getter
  @Setter
  @Entity
  @NoArgsConstructor
  @Table(name = &quot;pg_order&quot;)
  public class Order {
  
      @Id
      @GeneratedValue
      private Long id;
  
      private String address;
  
      @Column(name = &quot;phone_number&quot;)
      private String phoneNumber;
  
      @Temporal(TemporalType.TIMESTAMP)
      @Column(name = &quot;date_order&quot;)
      private Date dateOrder;
  
      @Enumerated(EnumType.STRING)
      @Column(name = &quot;order_status&quot;)
      private OrderStatus orderStatus;
  
      @Column(name = &quot;total_cost&quot;)
      private BigDecimal totalCost;
  
      @ManyToOne
      @JoinColumn(name = &quot;user_id&quot;)
      private User user;
  
      @OneToMany(mappedBy = &quot;order&quot;, cascade = CascadeType.ALL, orphanRemoval = true)
      private List&lt;CartItem&gt; cartItems = new ArrayList&lt;&gt;();
  
  
      @Override
      public String toString() {
          return &quot;Order{&quot; +
                  &quot;id=&quot; + id +
                  &quot;, address='&quot; + address + '\'' +
                  &quot;, phoneNumber='&quot; + phoneNumber + '\'' +
                  &quot;, dateOrder=&quot; + dateOrder +
                  &quot;, orderStatus=&quot; + orderStatus +
                  &quot;, totalCost=&quot; + totalCost +
                  &quot;, user=&quot; + user +
                  &quot;, cartItems=&quot; + cartItems +
                  '}';
      }
  }
  </code></pre>
  <p>When I find all coffees, I am getting errors:</p>
  <pre class="lang-java prettyprint-override"><code>2020-08-26 16: 03: 01.698 ERROR 8108 --- [nio-8080-exec-9] o.h.engine.jdbc.spi.SqlExceptionHelper: ERROR: column coffee0_1_.order_status does not exist
    Position: 487
  2020-08-26 16: 03: 01.799 ERROR 8108 --- [nio-8080-exec-9] oaccC [. [. [/]. [DispatcherServlet]: Servlet.service () for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n / a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
  
  org.postgresql.util.PSQLException: ERROR: column coffee0_1_.order_status does not exist
    Position: 487
  at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse (QueryExecutorImpl.java:2532) ~ [postgresql-42.2.14.jar: 42.2.14]
  at org.postgresql.core.v3.QueryExecutorImpl.processResults (QueryExecutorImpl.java:2267) ~ [postgresql-42.2.14.jar: 42.2.14]
  at org.postgresql.core.v3.QueryExecutorImpl.execute (QueryExecutorImpl.java:312) ~ [postgresql-42.2.14.jar: 42.2.14]
  at org.postgresql.jdbc.PgStatement.executeInternal (PgStatement.java:448) ~ [postgresql-42.2.14.jar: 42.2.14]
  at org.postgresql.jdbc.PgStatement.execute (PgStatement.java:369) ~ [postgresql-42.2.14.jar: 42.2.14]
  at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags (PgPreparedStatement.java:153) ~ [postgresql-42.2.14.jar: 42.2.14]
  at org.postgresql.jdbc.PgPreparedStatement.executeQuery (PgPreparedStatement.java:103) ~ [postgresql-42.2.14.jar: 42.2.14]
  at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery (ProxyPreparedStatement.java:52) ~ [HikariCP-3.4.5.jar: na]
  at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery (HikariProxyPreparedStatement.java) ~ [HikariCP-3.4.5.jar: na]
  at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract (ResultSetReturnImpl.java:57) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.Loader.getResultSet (Loader.java:2285) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.Loader.executeQueryStatement (Loader.java:2038) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.Loader.executeQueryStatement (Loader.java:2000) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.Loader.doQuery (Loader.java:951) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections (Loader.java:352) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.Loader.doList (Loader.java:2831) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.Loader.doList (Loader.java:2813) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.Loader.listIgnoreQueryCache (Loader.java:2645) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.Loader.list (Loader.java:2640) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.loader.hql.QueryLoader.list (QueryLoader.java:506) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list (QueryTranslatorImpl.java:400) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.engine.query.spi.HQLQueryPlan.performList (HQLQueryPlan.java:219) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.internal.SessionImpl.list (SessionImpl.java:1412) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.query.internal.AbstractProducedQuery.doList (AbstractProducedQuery.java:1565) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.query.internal.AbstractProducedQuery.list (AbstractProducedQuery.java:1533) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.query.Query.getResultList (Query.java:165) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList (CriteriaQueryTypeQueryAdapter.java:76) ~ [hibernate-core-5.4.17.Final.jar: 5.4.17.Final]
  at org.springframework.data.jpa.repository.support.SimpleJpaRepository.readPage (SimpleJpaRepository.java:637) ~ [spring-data-jpa-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll (SimpleJpaRepository.java:445) ~ [spring-data-jpa-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll (SimpleJpaRepository.java:410) ~ [spring-data-jpa-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) ~ [na: na]
  at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) ~ [na: na]
  at java.base / jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) ~ [na: na]
  at java.base / java.lang.reflect.Method.invoke (Method.java:566) ~ [na: na]
  at org.springframework.data.repository.core.support.ImplementationInvocationMetadata.invoke (ImplementationInvocationMetadata.java:72) ~ [spring-data-commons-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at org.springframework.data.repository.core.support.RepositoryComposition $ RepositoryFragments.invoke (RepositoryComposition.java:382) ~ [spring-data-commons-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at org.springframework.data.repository.core.support.RepositoryComposition.invoke (RepositoryComposition.java:205) ~ [spring-data-commons-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at org.springframework.data.repository.core.support.RepositoryFactorySupport $ ImplementationMethodExecutionInterceptor.invoke (RepositoryFactorySupport.java:549) ~ [spring-data-commons-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:186) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke (QueryExecutorMethodInterceptor.java:155) ~ [spring-data-commons-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke (QueryExecutorMethodInterceptor.java:130) ~ [spring-data-commons-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:186) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke (DefaultMethodInvokingMethodInterceptor.java:80) ~ [spring-data-commons-2.3.1.RELEASE.jar: 2.3.1.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:186) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction (TransactionAspectSupport.java:367) ~ [spring-tx-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke (TransactionInterceptor.java:118) ~ [spring-tx-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:186) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke (PersistenceExceptionTranslationInterceptor.java:139) ~ [spring-tx-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:186) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor $ CrudMethodMetadataPopulatingMethodInterceptor.invoke (CrudMethodMetadataPostProcessor.java:178) ~ [spring-data-jELpa.java:178) ~ [spring-data-jELpa-2.3.1.RASEEEL.1]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:186) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (ExposeInvocationInterceptor.java:95) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:186) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:212) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at com.sun.proxy. $ Proxy151.findAll (Unknown Source) ~ [na: na]
  at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) ~ [na: na]
  at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) ~ [na: na]
  at java.base / jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) ~ [na: na]
  at java.base / java.lang.reflect.Method.invoke (Method.java:566) ~ [na: na]
  at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection (AopUtils.java:344) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:205) ~ [spring-aop-5.2.8.RELEASE.jar: 5.2.8.RELEASE]
  at com.sun.proxy. $ Proxy84.findAll (Unknown Source) ~ [na: na]
  at ru.coffeetearea.service.CoffeeService.findAll (CoffeeService.java:107) ~ [main /: na]
  at ru.coffeetearea.controller.CoffeeController.findAll (CoffeeController.java:71) ~ [main /: na]
  at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) ~ [na: na]
  at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) ~ [na: na]
  at java.base / jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) ~ [na: na]
  at java.base / java.lang.reflect.Method.invoke (Method.java:566) ~ [na: na]
  at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke (InvocableHandlerMethod.java:190) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest (InvocableHandlerMethod.java:138) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle (ServletInvocableHandlerMethod.java:105) ~ [spring-webmvc-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod (RequestMappingHandlerAdapter.java:879) ~ [spring-webmvc-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal (RequestMappingHandlerAdapter.java:793) ~ [spring-webmvc-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle (AbstractHandlerMethodAdapter.java:87) ~ [spring-webmvc-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.servlet.DispatcherServlet.doDispatch (DispatcherServlet.java:1040) ~ [spring-webmvc-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet.java:943) ~ [spring-webmvc-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java:1006) ~ [spring-webmvc-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.servlet.FrameworkServlet.doGet (FrameworkServlet.java:898) ~ [spring-webmvc-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at javax.servlet.http.HttpServlet.service (HttpServlet.java:634) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet.java:883) ~ [spring-webmvc-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at javax.servlet.http.HttpServlet.service (HttpServlet.java:741) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:231) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:53) ~ [tomcat-embed-websocket-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:320) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke (FilterSecurityInterceptor.java:126) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter (FilterSecurityInterceptor.java:90) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter (ExceptionTranslationFilter.java:118) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.session.SessionManagementFilter.doFilter (SessionManagementFilter.java:137) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter (AnonymousAuthenticationFilter.java:111) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter (SecurityContextHolderAwareRequestFilter.java:158) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter (RequestCacheAwareFilter.java:63) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at ru.coffeetearea.security.jwt.JwtTokenFilter.doFilter (JwtTokenFilter.java:33) ~ [main /: na]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter (LogoutFilter.java:116) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter (HeaderWriterFilter.java:92) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal (HeaderWriterFilter.java:77) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:119) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter (SecurityContextPersistenceFilter.java:105) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal (WebAsyncManagerIntegrationFilter.java:56) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:119) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy.doFilterInternal (FilterChainProxy.java:215) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.security.web.FilterChainProxy.doFilter (FilterChainProxy.java:178) ~ [spring-security-web-5.3.3.RELEASE.jar: 5.3.3.RELEASE]
  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy.java:358) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy.java:271) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.springframework.web.filter.RequestContextFilter.doFilterInternal (RequestContextFilter.java:100) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:119) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.springframework.web.filter.FormContentFilter.doFilterInternal (FormContentFilter.java:93) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:119) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (CharacterEncodingFilter.java:201) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:119) ~ [spring-web-5.2.7.RELEASE.jar: 5.2.7.RELEASE]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:202) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:96) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:541) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:139) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java: 92) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:74) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:343) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.coyote.http11.Http11Processor.service (Http11Processor.java:373) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.coyote.AbstractProcessorLight.process (AbstractProcessorLight.java:65) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.coyote.AbstractProtocol $ ConnectionHandler.process (AbstractProtocol.java:868) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun (NioEndpoint.java:1590) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at org.apache.tomcat.util.net.SocketProcessorBase.run (SocketProcessorBase.java:49) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at java.base / java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128) ~ [na: na]
  at java.base / java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:628) ~ [na: na]
  at org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread.java:61) ~ [tomcat-embed-core-9.0.36.jar: 9.0.36]
  at java.base / java.lang.Thread.run (Thread.java:834) ~ [na: na]
  </code></pre>
  <p>P.S.I will once again write here that a query in the sql console is separately executed with the proper result.</p>
  <p>PROBLEM QUERY IS IN DRINK CLASS</p>