I have a project I'm building with maven and I need to generate a schema using the hbm2ddl tool from hibernate3-maven-plugin.
I need to create database with a table called Order like the SQL keyword and I don't know how to make maven to quote this table when it's generating the script. I've done a search and I found there is a property in hibernate to tell the hbm2ddl tool to this, but I can't tell the plugin to use it:
<property name="hbm2ddl.keywords">auto-quote</property>
If I don't quote the table, hbm2ddl generates a script:
create table Order (orderId varchar(36) not null, orderCode integer, customer varchar(36) not null, supplier varchar(36) not null, product varchar(36) not null, forecast float, dateRaised date not null, dateDispatched date, dateReceived date, quantityOrdered double precision not null, quantitySent double precision, primary key (orderId)) ENGINE=InnoDB;
that doesn't compile (due an obvious syntax error):
02:51:41,264 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: create table Order (orderId varchar(36) not null, orderCode integer, customer varchar(36) not null, supplier varchar(36) not null, product varchar(36) not null, forecast float, dateRaised date not null, dateDispatched date, dateReceived date, quantityOrdered double precision not null, quantitySent double precision, primary key (orderId)) ENGINE=InnoDB
02:51:41,264 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Order (orderId varchar(36) not null, orderCode integer, customer varchar(36) not' at line 1
This is the part of the pom.xml file:
<configuration>
<components>
<component>
<name>hbm2java</name>
<implementation>annotationconfiguration</implementation>
<outputDirectory>src/main/java</outputDirectory>
</component>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
<outputDirectory>src/main/resources</outputDirectory>
</component>
<component>
<name>hbm2doc</name>
<implementation>annotationconfiguration</implementation>
<outputDirectory>docs/html/hibernate</outputDirectory>
</component>
</components>
<componentProperties>
<create>true</create>
<drop>true</drop>
<configurationfile>src/main/resources/hibernate.cfg.xml</configurationfile>
<propertyfile>src/main/resources/database.properties</propertyfile>
<jdk5>true</jdk5>
<outputfilename>amasbe_db.sql</outputfilename>
</componentProperties>
</configuration>
Any tips or help is really appreciated.
Thank you!