<class name="manyToOne.Customer" table="CUSTOMER">
<id name="customerId" type="java.lang.Integer">
<column name="CUSTOMER_ID" />
<generator class="native" />
</id>
<property name="customerName" type="java.lang.String">
<column name="CUSTOMER_NAME" />
</property>
</class>
<class name="manyToOne.Order" table="ORDER">
<id name="orderId" type="java.lang.Integer">
<column name="ORDER_ID" />
<generator class="native" />
</id>
<property name="orderName" type="java.lang.String">
<column name="ORDER_NAME" />
</property>
<many-to-one name="customer" class="manyToOne.Customer" >
<column name="CUSTOMER_ID" />
</many-to-one>
</class>
报的错误:ERROR: HHH000388: Unsuccessful: create table ORDER (ORDER_ID integer not null auto_increment, ORDER_NAME varchar(255), CUSTOMER_ID integer, primary key (ORDER_ID))
八月 21, 2014 10:08:37 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: 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 (
ORDER_ID integer not null auto_increment,
ORDER_NAME var' at line 1
八月 21, 2014 10:08:37 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: HHH000388: Unsuccessful: alter table ORDER add index FK_p1xf4mmtq806hthtu6mxv2tf0 (CUSTOMER_ID), add constraint FK_p1xf4mmtq806hthtu6mxv2tf0 foreign key (CUSTOMER_ID) references CUSTOMER (CUSTOMER_ID)
八月 21, 2014 10:08:37 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: 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
add index FK_p1xf4mmtq806hthtu6mxv2tf0 (CUSTOMER_ID),
ad' at line 1
------解决方案--------------------
一对多和多对一没有配置好
------解决方案--------------------
你Customer和Order都是 many-to-one么?
------解决方案--------------------
你表明是带是s的吧
------解决方案--------------------
order是关键字吧,别用和关键字类似的表名