我在使用Hibernate Schema Updater时遇到了问题。 Hibernate在服务器启动时触发的语句是:
create table Match (id integer not null, guest varchar(255), home varchar(255), matchDate varchar(255), matchDay varchar(255), matchNumber varchar(255), resultPoints varchar(255), resultSets varchar(255), venue varchar(255), primary key (id))

我在命令行上尝试了这个声明但没有成功。但是,如果我将数据库名称添加到表名称,它可以工作:
create table ivolley.Match (id integer not null, guest varchar(255), home varchar(255), matchDate varchar(255), matchDay varchar(255), matchNumber varchar(255), resultPoints varchar(255), resultSets varchar(255), venue varchar(255), primary key (id))

有谁知道如何告诉Hibernate或数据库使用该前缀?
这是我的persistence.xml:
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="ivolley" transaction-type="RESOURCE_LOCAL">
<description></description>
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>java:jboss/datasources/Volleynator</non-jta-data-source>
<class>com.chopper.ivolley.server.entities.Match</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.max_fetch_depth" value="3" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
</properties>
</persistence-unit>
</persistence>
&#13;
谢谢,艾迪
答案 0 :(得分:0)
尝试default_schema
设置:
<property name="hibernate.default_schema" value="ivolley" />