Hello everybody,
This is my hbm.xml file:
<class name="com.mislbd.iris.distribution.belt.BeltDTO" table="Belt">
<id column="beltId" name="id">
<generator class="increment"/>
</id>
<property name="routeLength" />
<property name="code"/>
<property name="status"/>
<property name="remarks"/>
<list name="customerList">
<key column="beltId"/>
<index column="beltIndex"/>
<one-to-many class="com.mislbd.iris.sales.core.customer.CustomerDTO" />
</list>
</class>
I have two table <<belt>> and <<customer>>. One Belt can have many customers. When i run the above hbm.xml file under mysql it creates <<beltId>> on customer table. But in posgresql it creates exception. Here is the exception---
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
01 Jan 2004 14:03:47 -- ERROR -- Error while executing alter table Customer add
constraint FK27FBE3FEACFD0786 foreign key (beltId) references Belt
java.sql.SQLException: ERROR: ALTER TABLE: column "beltid" referenced in foreign
key constraint does not exist
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
at org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:197)
at org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:183)
at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:116)
at com.mislbd.tulip.orm.hibernate.Hibernator.buildSchema(Unknown Source)
at com.mislbd.tulip.orm.ORMappingFactory.initORMapper(Unknown Source)
at com.mislbd.tulip.business.BusinessFacadeRI.init(Unknown Source)
I m using Hibernate 2 and postgreSQL 7.3.
Any kind of help would be appreciated.
banik@mislbd.com