Hi,

I hope this isn't too off-topic, but I've seen a few JBoss posts
before...

I was getting the "Error while adding foreign key constraint" error,
running JBoss 3.0.5 with SAP DB 7.3.0.29:

2003-01-29 21:41:49,266 INFO 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Customer] Created table
'CUSTOMERS' successfully.
2003-01-29 21:41:49,266 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Customer] Executing
SQL: ALTER TABLE CUSTOMERS ADD CONSTRAINT FK_CUSTOMERS_DEALER FOREIGN
KEY (dealer_id) REFERENCES DEALERS (id)
2003-01-29 21:41:49,269 WARN 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Customer] Could not add
foreign key constraint: table=CUSTOMERS
2003-01-29 21:41:49,270 WARN  [org.jboss.system.ServiceController]
Problem starting service
jboss.j2ee:jndiName=ejb/bsl/bean/Customer,service=EJB
org.jboss.deployment.DeploymentException: Error while adding foreign key
constraint; - nested throwable:
(com.sap.dbtech.jdbc.exceptions.DatabaseException: [-3014] (at 58):
Invalid end of SQL statement)

The offending query being "ALTER TABLE CUSTOMERS ADD CONSTRAINT
FK_CUSTOMERS_DEALER FOREIGN KEY (dealer_id) REFERENCES DEALERS (id)"

The template for this was:
 <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY
(?3) REFERENCES ?4 (?5)</fk-constraint-template>

But for SAP DB (according to Pg 123) should be:
 <fk-constraint-template>ALTER TABLE ?1 ADD FOREIGN KEY ?2 (?3)
REFERENCES ?4 (?5)</fk-constraint-template>

...I think. Anyone can concur?

Unless I'm missing something obvious (it's getting late here :-) I'll
post a small update to JBoss.

Richard.




_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to