JBoss 3.0.0 seems unable to generate the correct SQL constraint for a compound primary key EJB, because it leaves the key field list empty. The server.log reports that it attempts to execute the following SQL statement:
CREATE TABLE <table_name> (<field_definitions>, CONSTRAINT PK_<table_name> PRIMARY KEY ())
and it obviously fails by a syntax error near "())".
The statement templates in standardjbosscmp-jdbc.xml are like the following:
<pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template>
and they seem substantially correct. I have reported this behavior with both embedded Hypersonic SQL and MySQL 3.23.
To overcome this problem I have temporarily disabled the pk constraint generation for compound key tables, but it is not a suitable solution.
Any help will be appreciated.
This works for me. Are you doing anything weird (non-spec compliant) with the primary key?
Can you post a bug report at source forge with the ejb-jar.xml file (or the relevant parts if it is huge).