-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: no composite key generated for collection of values
PostPosted: Sat Apr 14, 2007 1:40 am 
Newbie

Joined: Fri Apr 06, 2007 1:54 am
Posts: 14
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


Top
 Profile  
 
 Post subject: Re: no composite key generated for collection of values
PostPosted: Sat Nov 03, 2012 6:35 am 
Newbie

Joined: Sun Mar 04, 2012 1:23 pm
Posts: 7
See also: https://forum.hibernate.org/viewtopic.php?f=1&t=958891


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.