- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 JPQL 问题...我正在尝试使用 Vaadin、Shiro、MySQL、JPA 制作一个 Web 应用程序...几年前我制作了一个桌面应用程序,并使用其中的所有 JPA 库项目。我的 mysql-connector-java-5.0.8-bin.jar 有问题。当我尝试运行该项目时,出现 SQL 异常 com.mysql.jdbc.driver not found。很少有人遇到同样的问题,并通过用 5.1.17 或更高版本替换 mysql 连接器 5.0.8 来解决它。我做了这个,现在我遇到了一个新的查询问题。
这个查询工作正常:
TypedQuery<Products> q = em.createQuery("SELECT e FROM Products e",Products.class);
List<Products> products = q.getResultList();
此查询无法正常工作:
TypedQuery<Products> q = em.createQuery("SELECT e FROM Products e WHERE e.name LIKE 'something'",Products.class);
Products products = q.getSingleResult();
我成为了这个异常(exception):
15:45:25,879 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Hibernate:
15:45:25,879 INFO [stdout] (http-localhost-127.0.0.1-8080-1) WITH query AS (select
15:45:25,880 INFO [stdout] (http-localhost-127.0.0.1-8080-1) product0_.idproduct as idproduct_495_,
15:45:25,880 INFO [stdout] (http-localhost-127.0.0.1-8080-1) product0_.name as name495_,
15:45:25,904 INFO [stdout] (http-localhost-127.0.0.1-8080-1) ROW_NUMBER() OVER (
15:45:25,905 INFO [stdout] (http-localhost-127.0.0.1-8080-1) ORDER BY
15:45:25,905 INFO [stdout] (http-localhost-127.0.0.1-8080-1) CURRENT_TIMESTAMP) as __hibernate_row_nr__
15:45:25,905 INFO [stdout] (http-localhost-127.0.0.1-8080-1) from
15:45:25,905 INFO [stdout] (http-localhost-127.0.0.1-8080-1) products product0_
15:45:25,906 INFO [stdout] (http-localhost-127.0.0.1-8080-1) where
15:45:25,906 INFO [stdout] (http-localhost-127.0.0.1-8080-1) product0_.name like 'something') SELECT
15:45:25,906 INFO [stdout] (http-localhost-127.0.0.1-8080-1) *
15:45:25,907 INFO [stdout] (http-localhost-127.0.0.1-8080-1) FROM
15:45:25,907 INFO [stdout] (http-localhost-127.0.0.1-8080-1) query
15:45:25,907 INFO [stdout] (http-localhost-127.0.0.1-8080-1) WHERE
15:45:25,907 INFO [stdout] (http-localhost-127.0.0.1-8080-1) __hibernate_row_nr__ >= ?
15:45:25,908 INFO [stdout] (http-localhost-127.0.0.1-8080-1) AND __hibernate_row_nr__ < ?
15:45:25,924 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost-127.0.0.1-8080-1) SQL Error: 1064, SQLState: 42000
15:45:25,924 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost-127.0.0.1-8080-1) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WITH query AS (select product0_.idproduct as idproduct_495_, product0_' at line 1
15:45:25,926 SEVERE [com.vaadin.server.DefaultErrorHandler] (http-localhost-127.0.0.1-8080-1) : javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WITH query AS (select product0_.idproduct as idproduct_495_, product0_' at line 1
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:313) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at com.vaadin.demo.dashboard.DashboardUI.init(DashboardUI.java:105) [classes:]
at com.vaadin.ui.UI.doInit(UI.java:610) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:223) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:73) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1371) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238) [vaadin-server-7.1.6.jar:7.1.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_60]
Caused by: org.hibernate.exception.SQLGrammarException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WITH query AS (select product0_.idproduct as idproduct_495_, product0_' at line 1
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:82) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at com.sun.proxy.$Proxy53.executeQuery(Unknown Source)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1978) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:829) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2463) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2449) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2279) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.list(Loader.java:2274) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:196) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1115) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:280) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
... 34 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WITH query AS (product0_.idproduct as idproduct_495_, product0_' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_60]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_60]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_60]
at java.lang.reflect.Constructor.newInstance(Unknown Source) [rt.jar:1.7.0_60]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.Util.getInstance(Util.java:386) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2281) [mysql-connector-java-5.1.17-bin.jar:]
at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:107)
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_60]
at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
... 49 more
15:45:25,971 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/Dashboard].[VaadinServlet]] (http-localhost-127.0.0.1-8080-1) Servlet.service() for servlet VaadinServlet threw exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WITH query AS (product0_.idproduct as idproduct_495_, product0_' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_60]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_60]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_60]
at java.lang.reflect.Constructor.newInstance(Unknown Source) [rt.jar:1.7.0_60]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.Util.getInstance(Util.java:386) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) [mysql-connector-java-5.1.17-bin.jar:]
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2281) [mysql-connector-java-5.1.17-bin.jar:]
at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:107)
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_60]
at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at com.sun.proxy.$Proxy53.executeQuery(Unknown Source)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1978) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:829) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2463) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2449) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2279) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.Loader.list(Loader.java:2274) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:196) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1115) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:280) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at com.vaadin.demo.dashboard.DashboardUI.init(DashboardUI.java:105) [classes:]
at com.vaadin.ui.UI.doInit(UI.java:610) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:223) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:73) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1371) [vaadin-server-7.1.6.jar:7.1.6]
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238) [vaadin-server-7.1.6.jar:7.1.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-all-1.2.1.jar:1.2.1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_60]
谢谢...
编辑 1我测试了另一个查询,它也很好......
TypedQuery<Products> query1 = em.createQuery("SELECT e FROM Products e WHERE e.name LIKE 'something' OR e.name LIKE 'somethingElse' ",Products.class);
List<Products> list = query1.getResultList();
Where 语句不是问题。问题是 getSingleResult,但我不知道如何解决......谢谢...
最佳答案
你可以尝试一下吗
TypedQuery<Products> q = em.createQuery("SELECT e FROM Products e WHERE e.name LIKE :something ",Products.class);
q.setParameter("something ", something );
Products products = q.getSingleResult();
关于mysql - jpql with WHERE 语句 = SQL 语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24439575/
我想写这样的查询:- Select u from bookmaster u order by Year(b.createDate),Month(b.createDate),day(b.createDa
例如:选择不同的新 JPQA.QueryResultObjectV1(space.name,spaceID) "+ "from Space space,Building building,Floor
例如:选择不同的新 JPQA.QueryResultObjectV1(space.name,spaceID) "+ "from Space space,Building building,Floor
我有两张 table 第一张表 - 事件第二张表 - 类别 @Entity public class Event { @Id @GeneratedValue(strategy = Generation
我在我的 DAO 中使用 entityManager。 要创建表格,我使用: String CREATE_TABLE = "CREATE TABLE if not exists cats (name
在 JPQL 中,我可以通过以下方式检索实体: query = entityManager.createQuery("select c from Category c"); List categori
我需要执行以下选择: select c.address from Customer c where lower(trim(c.name)) = :name 但是我得到以下异常: javax.persi
我无法使此查询正常工作: Query query = eManager.createQuery("select c FROM News c WHERE c.NEWSID = :id",News.cla
我在我的 msql 表列中有 Long 类型,该列表示位标记。 我需要选择为其设置了所有几个标志的对象: columnValue & flags = columnValue 我尝试: javax.pe
请查看这篇文章的末尾(找到了另一种但也不起作用的方法)。第二种方式应该是更好的方式,如果有一天它起作用的话;) 我有一个由两个多对多关系组成的实体:MainEntity 有很多 A,MainEntit
首先声明我不是数据库专家。这些东西把我搞糊涂了,但不幸的是我在工作中被迫这样做,所以我有点卡住了:-) 我试图通过在 JPQL 中工作来获得一个复杂的订单,但我一点运气都没有。 我当前的查询如下所示:
我需要将此自联接转换为 JPQL: SELECT s1.* FROM site AS s1 JOIN (SELECT site_type, MAX(last_update_date) AS LastU
如果我有一个扩展 Fruit 的类 Apple,我如何编写一个 JPQL 查询来返回所有严格意义上是 Fruits 而不是 Apples 的对象? 最佳答案 这在 JPA 2.0 中是可能的,使用 T
我正在尝试获取 Order[] 数组,其中包括未收到相关文档的所有订单。 我尝试了这个查询,它返回了正确的行数。 @Query("Select o FROM Order o INNER JOIN o
我正在尝试根据用户可以选择的可能日期列表对日期进行搜索。使用日历,我要求用户输入一个日期,然后我想获取在“data_possibile”列表中具有该日期的所有可能数据包。 这是我正在使用的查询: @N
我想构建一个 JPQL 查询来将该结构的数据映射到这个 DTO: @AllArgsConstructor class UserDTO { long userId; long countOfCo
我必须对表执行批量更新。 做一个快速的例子: UPDATE Book b SET b.amount = b.amount + 1 WHERE b IN ( :books ) 问题是 b.amount
我有以下 JPA实体: @Entity class UserClient{ @Id @GeneratedValue(strategy = GenerationType.AUTO)
我有一个实体(例如 Setting),其中包含集合(例如 Settings.languages)和另一个对象(Language 的实例)。 有没有办法选择其集合实体中包含所需属性值的所有实体?例如获取
我正在使用 spring data jpa:过滤父对象的子对象的最佳方法是什么?在我下面的例子中我想要具有事件子对象的父对象,也只想要事件子对象作为父对象的列表 @Query(select dis
我是一名优秀的程序员,十分优秀!