简体   繁体   中英

Error creating table using Hibernate Schema Updater

I'm facing problems using Hibernate Schema Updater. The statement Hibernate fires at server startup is:

 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)) 

I tried that statement on the commandline without success. However, if i prepend the database name to the table name, it works:

 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)) 

Has anyone an idea how to tell Hibernate or the database to use that prefix?

Here is my 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> 

Thanks, Eddy

尝试default_schema设置:

<property name="hibernate.default_schema" value="ivolley" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM