Mysql 为什么我在本地的TomEE 1.6中遇到HsqlException?

Mysql 为什么我在本地的TomEE 1.6中遇到HsqlException?,mysql,hibernate,hsqldb,apache-tomee,Mysql,Hibernate,Hsqldb,Apache Tomee,org.hsqldb.hsqldb异常:用户缺少权限或未找到对象:ENRG enrg是一个表名。它在数据库中,我以root用户身份连接。所以这个错误信息至少可以说是误导性的。由于我的应用程序使用的是HibernateJAR,我甚至不明白为什么会看到这种情况。根据我在Web上的发现,可能是我本地的Tomee1.6在Eclipse中出现了一些配置错误。不过,我还没有弄明白该怎么做 只是为了证明这不是sql或权限问题: 此代码失败,出现上述异常: Query q=entityManager.creat

org.hsqldb.hsqldb异常:用户缺少权限或未找到对象:ENRG

enrg是一个表名。它在数据库中,我以root用户身份连接。所以这个错误信息至少可以说是误导性的。由于我的应用程序使用的是HibernateJAR,我甚至不明白为什么会看到这种情况。根据我在Web上的发现,可能是我本地的Tomee1.6在Eclipse中出现了一些配置错误。不过,我还没有弄明白该怎么做

只是为了证明这不是sql或权限问题: 此代码失败,出现上述异常:

Query q=entityManager.createNativeQuery("insert into enrg values (null, 'ws', null, 'test', 'notes');");
q.executeUpdate();
我复制了这个插件,并将其粘贴到MySQL命令行客户端,效果很好。两种情况下的登录凭据相同(root/root)

此jar中存在异常:c:\tomee16\lib\sqldb-2.3.0.jar

我正在使用JPA2.0和Hibernate4

persistence.xml

<?xml version="1.0" encoding="UTF-8"?>

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
         version="2.0">

<persistence-unit name="default" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>my classess</class>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>


    <properties>
        <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
        <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/dbname?useUnicode=yes&amp;characterEncoding=utf8;" />
        <property name="javax.persistence.jdbc.user" value="root" />
        <property name="javax.persistence.jdbc.password" value="root" />

        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        <property name="hibernate.show_sql" value="true" />
    </properties>

    </persistence-unit>

</persistence>

org.hibernate.ejb.HibernatePersistence
我的女同学
假的
更新

Query q=entityManager.createNativeQuery(“show tables;”)原因
java.sql.SQLSyntaxErrorException:意外标记:SHOW
。我的应用程序不知道它正在与MySQL数据库通信

此外,启动时,这里有几个警告: 警告:jar'C:\javawork\webadmin.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webadmin\WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final.jar'包含有问题的类:javax.persistence.Entity。它将被忽略。 警告:jar'C:\javawork\webadmin.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webadmin\WEB-INF\lib\jboss-transaction-api_1.1\u spec-1.0.1.Final.jar'包含有问题的类:javax.transaction.transaction。它将被忽略。
2013年12月7日凌晨1:22:37 org.apache.openejb.config.ConfigurationFactory configureApplication

发现应用程序从未连接到数据库。通过更改服务器位置将数据源添加到tomee.xml,可以建立连接

详情如下: