-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: one-to-many problem in postgresql
PostPosted: Thu Jan 01, 2004 4:24 am 
Newbie

Joined: Sun Nov 30, 2003 10:09 am
Posts: 14
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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 02, 2004 7:39 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Are you using SchemaExport ?
Check the log info of SchemaExport to see why this column isn't created.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.