-->
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.  [ 3 posts ] 
Author Message
 Post subject: mapping one to many
PostPosted: Mon Oct 05, 2009 3:01 pm 
Newbie

Joined: Mon Oct 05, 2009 2:50 pm
Posts: 1
hi!
when i want to create a table that its goal is to connect between objects, do i need to create it with primary key?
for example, i saw here:
http://www.vaannila.com/hibernate/hiber ... any-3.html

that the STUDENT_PHONE table doesn't have a primary key.

what is the best way to use? with primary key or without?


Top
 Profile  
 
 Post subject: Re: mapping one to many
PostPosted: Wed Oct 07, 2009 12:38 am 
Newbie

Joined: Wed Sep 30, 2009 4:59 am
Posts: 4
Dont create table manually by using the query in your database.
When you use this
Code:
<property name="hbm2ddl.auto">create-drop</property>

in your hibernate configuration file, it will automatically create the table.
However, If you use this
Code:
<generator class="native" />
in your id tag it will automatically creates that field with primary key.
native denotes database handling the primary key generation.

-vignesh


Top
 Profile  
 
 Post subject: Re: mapping one to many
PostPosted: Wed Oct 07, 2009 12:45 am 
Newbie

Joined: Wed Sep 30, 2009 4:59 am
Posts: 4
In future dont give any public forum link here for your reference.
If you want to know something post your queries exactly what you want?
No one go and see the link and suggest the solution.
Use CODE TAG wisely

-vignesh


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.