dear friends,
i've built a project based on MyEclipse, which have been integrated with struts and hibernate. Some error as follow occured when i run the project.
Quote:
(0 ms) [http-8080-1] ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate#execute : Unsuccessful: create table tour.base_hotel (id integer not null, typeId_1 integer, totalTime float, totalMoney float, line varchar(255), typeId_2 integer, scenerySpotList text, stopList text, hotel_id integer, hotelName varchar(20), hotelClassType varchar(16), hotelPrice float, primary key (id, typeId_1, totalTime, totalMoney, line, typeId_2, scenerySpotList, stopList, hotel_id, hotelName, hotelClassType, hotelPrice))
(0 ms) [http-8080-1] ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate#execute : BLOB/TEXT column 'scenerySpotList' used in key specification without a key length
(15 ms) [http-8080-1] ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate#execute : Unsuccessful: create table tour.problem_hotel (id integer not null, time float, realTime float, money float, realMoney float, relationTime float, relationMoney float, typeid_2 integer, typeid_1 integer, line varchar(45), stopList varchar(45), scenerySpotMoney float, generalLine text, hotel_id integer, contradictionType varchar(10), hotelNo integer, hotelName varchar(20), hotelClassType varchar(16), hotelPrice float, primary key (id, time, realTime, money, realMoney, relationTime, relationMoney, typeid_2, typeid_1, line, stopList, scenerySpotMoney, generalLine, hotel_id, contradictionType, hotelNo, hotelName, hotelClassType, hotelPrice))
(15 ms) [http-8080-1] ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate#execute : Too many key parts specified; max 16 parts allowed
(15 ms) [http-8080-1] ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate#execute : Unsuccessful: create table tour.stop_tool (id integer not null, startNo integer, endNo integer, distance float, toolNo integer, startPicture varchar(10), endPicture varchar(10), toolName varchar(16), speed float, price float, startPrice float, startLenght float, primary key (id, startNo, endNo, distance, toolNo, startPicture, endPicture, toolName, speed, price, startPrice, startLenght))
(31 ms) [http-8080-1] ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate#execute : Table 'stop_tool' already exists
The 'base_hotel' above is a view stem form table 'base' and table 'hotel'. And the 'problem_hotel' and 'stop_tool' have the similar problem.
Here's the tools' version i am using:
hibernate 3.1,
sturts 1.2
MySQL 5.1.11
The mapping file is as follow,Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.tour.struts.forms.BaseHotel" table="base_hotel" catalog="tour">
<composite-id name="id" class="com.tour.struts.forms.BaseHotelId">
<key-property name="id" type="integer">
<column name="id" />
</key-property>
<key-property name="hotel_id" type="integer">
<column name="hotel_id"/>
</key-property>
</composite-id>
<property name="typeId_1" type="integer">
<column name="typeId_1" />
</property>
<property name="totalTime" type="float">
<column name="totalTime" precision="22" scale="0"/>
</property>
<property name="totalMoney" type="float">
<column name="totalMoney" precision="22" scale="0" />
</property>
<property name="line" type="string">
<column name="line"/>
</property>
<property name="typeId_2" type="integer">
<column name="typeId_2"/>
</property>
<property name="scenerySpotList" type="string">
<column name="scenerySpotList" length="65535"/>
</property>
<property name="stopList" type="string">
<column name="stopList" length="65535"/>
</property>
<property name="hotelName" type="string">
<column name="hotelName" length="20"/>
</property>
<property name="hotelClassType" type="string">
<column name="hotelClassType" length="16"/>
</property>
<property name="hotelPrice" type="float">
<column name="hotelPrice" precision="12" scale="0"/>
</property>
</class>
</hibernate-mapping>
And the hibernate.cfg.xml isCode:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="connection.username">root</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/tour?useUnicode=true&characterEncoding=UTF-8
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hbm2ddl.auto">update</property>
<property name="connection.password">root</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="show_sql">true </property>
<mapping resource="com/tour/table/Base_hotelTable.hbm.xml" />
<mapping resource="com/tour/table/BaseTable.hbm.xml" />
<mapping resource="com/tour/table/HotelTable.hbm.xml" />
<mapping resource="com/tour/table/Problem_hotelTable.hbm.xml" />
<mapping resource="com/tour/table/ProblemTable.hbm.xml" />
<mapping resource="com/tour/table/ScenerySpotTable.hbm.xml" />
<mapping resource="com/tour/table/ScenerySpotTypeTable.hbm.xml" />
<mapping resource="com/tour/table/Stop_toolTable.hbm.xml" />
<mapping resource="com/tour/table/StopRelationTable.hbm.xml" />
<mapping resource="com/tour/table/StopTable.hbm.xml" />
<mapping resource="com/tour/table/StrategyTable.hbm.xml" />
<mapping resource="com/tour/table/ToolTable.hbm.xml" />
</session-factory>
</hibernate-configuration>
This problem have perplexed me for days, any constructive suggestion will be appreciated.
Regards,
Iwill