Hibernate version:
3.2.3
Mapping documents:
Code:
<set name="emailAddresses" table="PERSON_EMAIL_ADDR" >
<key column="PERSON_ID"/>
<element type="string" column="EMAIL_ADDR"/>
</set>
Name and version of the database you are using:MySQL 4.1
The generated SQL (show_sql=true):Code:
create table PERSON_EMAIL_ADDR (
PERSON_ID bigint not null,
EMAIL_ADDR varchar(255)
) ENGINE=InnoDB;
Hello
At
http://www.hibernate.org/hib_docs/v3/re ... ollections it says "You can see that the primary key of the collection table is in fact a composite key, using both columns." and the diagram shows:
Code:
___________________
| |
| PERSON_EMAIL_ADDR |
|___________________|
| *PERSON_ID |
| *EMAIL_ADDR |
|___________________|
The problem is that the script that hbm2ddl generates does not contain unique (`PERSON_ID`, `EMAIL_ADDR`) so the composite key is never created in the database.
I run hbm2ddl.SchemaExport with parameters --text --format --delimiter=; and dialect org.hibernate.dialect.MySQLInnoDBDialect
What am I doing wrong?
thanks