0

我在 flex、blazeds、hibernate jpa、tomcat 和 mysql 中工作。这是我开始项目时面临的问题:

05.06.2012 22:33:29.459  INFO     org.hibernate.cfg.annotations.Version     - Hibernate Annotations 3.4.0.GA
05.06.2012 22:33:29.479  INFO     org.hibernate.cfg.Environment             - Hibernate 3.3.2.GA
05.06.2012 22:33:29.482  INFO     org.hibernate.cfg.Environment             - hibernate.properties not found
05.06.2012 22:33:29.487  INFO     org.hibernate.cfg.Environment             - Bytecode provider name : javassist
05.06.2012 22:33:29.493  INFO     org.hibernate.cfg.Environment             - using JDK 1.4 java.sql.Timestamp handling
05.06.2012 22:33:29.645  INFO     org.hibernate.annotations.common.Version  - Hibernate Commons Annotations 3.1.0.GA
05.06.2012 22:33:29.650  INFO     org.hibernate.ejb.Version                 - Hibernate EntityManager 3.4.0.GA

这是我在 src/META-INF 下的 persistence.xml 文件:

<persistence version="1.0"
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_1_0.xsd">

<persistence-unit name="consultant_db">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>


    <class>com.adobe.demo.domain.Permission</class>
    <class>com.adobe.demo.domain.Role</class>
    <class>com.adobe.demo.domain.User</class>

    <properties>
        <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
        <property name="hibernate.connection.url" value="jdbc:mysql://localhost/consultant_db" />
        <property name="hibernate.connection.username" value="root" />
        <property name="hibernate.connection.password" value="" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />

        <property name="hibernate.connection.pool_size" value="6" />
        <property name="hibernate.connection.autoReconnect" value="true" />
        <property name="hibernate.generate_statistics" value="false" />
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.use_sql_comments" value="false" />
        <property name="hibernate.hbm2ddl.auto" value="update" />
    </properties>


</persistence-unit>

但如果我删除该行: <class>com.adobe.demo.domain.User</class> 将创建其他 2 个表。我应该怎么办?

4

1 回答 1

0

是一个类似的问题。OP 试图创建一个“用户”表,但失败了。OP 能够通过User@Table(name = "\"user\"").

我还提供了一些有关如何解决此类问题的提示。

于 2012-06-09T18:01:24.443 回答