I meant, I had the same problem as the OP in beta-4 and after that tried CVS HEAD also, just to avoid being flamed (have read the "How To Ask For Help" carefully) ;-)
Thanks a lot for the quick response.
Actually my original mapping did not contain a composite-element in a set, but in a list:
Code:
<hibernate-mapping>
<class name="Invoice" table="INVOICES">
<id name="id" column="INVOICE_ID" type="long">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
<property name="invoiceDate" type="date" not-null="true"/>
<list name="entries" table="INVOICE_ENTRIES">
<key column="INVOICE_ID"/>
<list-index column="POSITION"/>
<composite-element class="InvoicePosition">
<property name="description" type="string"/>
<property name="amount" type="double"/>
</composite-element>
</list>
</class>
</hibernate-mapping>
I assume, the fix is for both cases?
By the way, I tried the hbm2ddl task with the Invoice mapping from above and got these output and exceptions:
Code:
create table INVOICES (
INVOICE_ID bigint generated by default as identity (start with 1),
invoiceDate date not null,
primary key (INVOICE_ID)
);
create table INVOICE_ENTRIES (
INVOICE_ID bigint not null,
description varchar(255),
amount double,
POSITION integer not null,
primary key (INVOICE_ID, POSITION)
);
alter table INVOICE_ENTRIES
add constraint FKA45A293E4A039E7A
foreign key (INVOICE_ID)
references INVOICES;
3 errors occurred while performing <hbm2ddl>.
Error #1: java.sql.SQLException: Table already exists: INVOICES in statement [create table INVOICES]
Error #1: java.sql.SQLException: Unexpected token: POSITION in statement [create table INVOICE_ENTRIES (INVOICE_ID bigint not null, description varchar(255), amount double, POSITION]
Error #1: java.sql.SQLException: Table not found: INVOICE_ENTRIES in statement [alter table INVOICE_ENTRIES]
The generated schema looks OK to me, however.
Best regards,
Sven