This probably is a a problem with the mapping but it might be a bug also. I'm sure the experts here will be able to help...
Here is the simplified mapping version of the mapping we are using:
<hibernate-mapping>
<class name="testing.WhatThe" table="WhatThe" dynamic-update="false" dynamic-insert="false" >
<id name="id" column="WhatThe_ID" type="java.lang.Long" >
<generator class="native"> </generator>
</id>
<property
name="strongPersistentIdentifier"
type="java.lang.String"
update="true"
insert="true" >
<column
name="StrongPersistentIdentifier"
unique-key="SPI_KEY"
unique="true"
/>
</property>
</class>
</hibernate-mapping>
The generated sql for Oracle is:
create table WhatThe (
WhatThe_ID NUMBER(19,0) not null,
StrongPersistentIdentifier VARCHAR2(255) unique,
primary key (WhatThe_ID),
unique (StrongPersistentIdentifier)
);
This causes an extra unique key error from Oracle. Removing the
"unique (StrongPersistentIdentifier)" line from the generated SQL is the correct DDL for Oracle.
Searches on the forum didn't reveal any obvious answers but my apologies ahead of time if this is a known issue.
|