-->
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: hbm2dll schema generation for the "Collection of values
PostPosted: Tue May 02, 2006 12:32 am 
Newbie

Joined: Tue May 02, 2006 12:20 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.1.2
Mapping documents:
from document 1.3.4


Code:
<!DOCTYPE hibernate-mapping PUBLIC
      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="com.tanabe.hibernate.pojo.Person" table="person">
    <id name="id" column="person_id">
      <generator class="native"/>
    </id>
    <property name="age"/>
    <property name="firstName"/>
    <property name="lastName"/>
    <set name="emailAddresses" table="person_email_addr">
      <key column="person_id"/>
      <element type="string" column="email_addr"/>
    </set>
  </class>
</hibernate-mapping>


The generated SQL (show_sql=true):

create table person_email_addr (person_id bigint not null, email_addr varchar(255))
alter table person_email_addr add constraint FKBC8ADDEF605C68A foreign key (person_id) references person

in chapter1.3.4
it says "You can see that the primary key of the collection table is in fact a composite key, using both columns. This also implies that there can't be duplicate email addresses per person, which is exactly the semantics we need for a set in Java."

but the sql generated by schemaexport doesnt look like it.
there is just one foreign key for person_id,
but no primary key constrain for person_email_addr table.
or its my miss understanding?


Top
 Profile  
 
 Post subject: Re: hbm2dll schema generation for the "Collection of values
PostPosted: Sat Nov 03, 2012 6:36 am 
Newbie

Joined: Sun Mar 04, 2012 1:23 pm
Posts: 7
I'm also seeing this problem with Hibernate 3.6.10 and using PostgreSQL.

The generated table does not have any primary key. This is in contrast with what the documentation says.

I opened https://hibernate.onjira.com/browse/HHH-7750 for this.


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.