-->
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: SchemaExport create a table twice in a N:N bidirection
PostPosted: Tue Sep 14, 2004 7:58 am 
Newbie

Joined: Tue Sep 14, 2004 7:37 am
Posts: 3
Hibernate2.1.2

Code:
User.hbm.xml:
...
   <set name="role" table="User-Role">
     <key column="user_id"/>
     <many-to-many column="role_id" class="Role"/>
  </set>
...

Role.hbm.xml:
...
  <set name="user" table="User_Role">
     <key column="role_id"/>
     <many-to-many column="user_id" class="User"/>
  </set>
...





when schemaexport(cfg).create(true,true) ,
I am suprised when a duplicate ddl display and show miror error:
...
Code:
create table Roles (
   role_id VARCHAR(40) not null,
   rolename VARCHAR(20),
   brief VARCHAR(40),
   primary key (role_id)
)
create table User (
   id VARCHAR(40) not null,
   login VARCHAR(20) not null unique,
   password VARCHAR(20) not null,
   valid BIT,
   primary key (id)
)
create table User-Role (
   user_id VARCHAR(40) not null,
   role_id VARCHAR(40) not null,
   primary key (user_id, role_id)
)
...



please help and thanks a lot


Top
 Profile  
 
 Post subject: Sorry for the top error ddl
PostPosted: Tue Sep 14, 2004 8:00 am 
Newbie

Joined: Tue Sep 14, 2004 7:37 am
Posts: 3
Sorry for the error ddl logging:


Code:
...
create table User_Role (
   role_id VARCHAR(40) not null,
   user_id VARCHAR(40) not null,
   primary key (role_id, user_id)
)
create table Roles (
   role_id VARCHAR(40) not null,
   rolename VARCHAR(20),
   brief VARCHAR(40),
   primary key (role_id)
)
create table User (
   id VARCHAR(40) not null,
   login VARCHAR(20) not null unique,
   password VARCHAR(20) not null,
   valid BIT,
   primary key (id)
)
create table User-Role (
   user_id VARCHAR(40) not null,
   role_id VARCHAR(40) not null,
   primary key (user_id, role_id)
)
...



the duplicate User-Role display strangly
why????


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 14, 2004 8:02 am 
Newbie

Joined: Tue Sep 14, 2004 7:37 am
Posts: 3
Oh my god ,please delete it


User-Role AND User_Role


Sorry


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.