Java com.mysql.jdbc.exceptions.MySQLSyntaxErrorException
在tomcat上运行的java web服务中使用hibernate的reveres工程特性 尝试查询我的mySQL数据库时出现以下错误: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:您有一个 SQL语法错误;检查与您的产品相对应的手册 MySQL服务器版本,以便在“.users users0\u0”附近使用正确的语法 在1号线 运行时:Java com.mysql.jdbc.exceptions.MySQLSyntaxErrorException,java,mysql,hibernate,Java,Mysql,Hibernate,在tomcat上运行的java web服务中使用hibernate的reveres工程特性 尝试查询我的mySQL数据库时出现以下错误: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:您有一个 SQL语法错误;检查与您的产品相对应的手册 MySQL服务器版本,以便在“.users users0\u0”附近使用正确的语法 在1号线 运行时: Query q = session.createQuery("from Users"); Lis
Query q = session.createQuery("from Users");
List<Users> result = q.list();
也许,我的映射有问题,但我找不到什么。
感谢您在advanced中提供的帮助。如果您尝试使用此HQL-从用户u中选择u,会发生什么情况?您是否指的是正确的数据库resqueuedb,其中有一个名为Users的表?是的,数据库名称正常,并且有一个名为Users的表。至于Tiny建议的,它会引发相同的异常。不完全确定,但是你能试着从用户那里使用而不是从用户那里检查u对u吗?是的,正如我之前提到的——试过使用它。对于您所建议的,HQL查询并非如此。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="resSession">
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">ResqueueDBA1</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/resqueuedb</property>
<property name="hibernate.connection.username">Resqueue</property>
<property name="hibernate.default_schema">resqueuedb</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.search.autoregister_listeners">false</property>
<mapping class="com.resqueue.hibernate.Openinghours" />
<mapping class="com.resqueue.hibernate.Branches" />
<mapping class="com.resqueue.hibernate.Privileges" />
<mapping class="com.resqueue.hibernate.Queues" />
<mapping class="com.resqueue.hibernate.Businesses" />
<mapping class="com.resqueue.hibernate.Branchservices" />
<mapping class="com.resqueue.hibernate.Usersbranchservicesprivilege" />
<mapping class="com.resqueue.hibernate.Buisnessservices" />
<mapping class="com.resqueue.hibernate.Users" />
<mapping class="com.resqueue.hibernate.Buisnessescategories" />
<mapping class="com.resqueue.hibernate.Specialevents" />
<mapping class="com.resqueue.hibernate.Employeesbranchservicesprivilege" />
<mapping class="com.resqueue.hibernate.Employees" />
<mapping class="com.resqueue.hibernate.Buisnessemployeerole" />
</session-factory>
</hibernate-configuration>
package com.resqueue.hibernate;
@Entity
@Table(name = "users", catalog = "resqueuedb")
public class Users implements java.io.Serializable {
...