-->
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: @JoinColumn settings
PostPosted: Mon Aug 28, 2006 7:56 pm 
Newbie

Joined: Mon Aug 28, 2006 12:13 pm
Posts: 4
Hi All,
if I create join table like this:

@OneToMany
@ LazyCollection ( LazyCollectionOption.FALSE )
@JoinTable(
name="authorities",
joinColumns = { @JoinColumn( name="user_id") },
inverseJoinColumns = @JoinColumn( name="role_id")
)

there is a unique constraint on role_id . what should I use if I need role_id in join table without any constraints?


thanks.

PS
inverseJoinColumns = @JoinColumn( name="role_id",unique=false)
didn't help.

tabel created like:

CREATE TABLE authorities
(
user_id int8 NOT NULL,
role_id int8 NOT NULL,
CONSTRAINT authorities_pkey PRIMARY KEY (user_id, role_id),
CONSTRAINT fk2b0f1321a4363147 FOREIGN KEY (user_id)
REFERENCES users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk2b0f1321ff0b6d67 FOREIGN KEY (role_id)
REFERENCES authority (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT authorities_role_id_key UNIQUE (role_id)
)

is there any way to get rid of this
CONSTRAINT authorities_role_id_key UNIQUE (role_id) ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 12:59 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
use a @ManyToMany because that what it means if you remove the constraint

_________________
Emmanuel


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.