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