在使用Hibernate中,建立了一个对象模型,内有id name普通属性外,还有List,Map,Set,String[]。随后自动导出表,生成了5张表。发出的SQL语句如下:
create table t_CollectionMapping (id number(10,0) not null, name varchar2(255 char), primary key (id))
create table t_array_value (array_id number(10,0) not null, array_value varchar2(255 char), array_index number(10,0) not null, primary key (array_id, array_index))
create table t_list_value (list_id number(10,0) not null, list_value varchar2(255 char), list_index number(10,0) not null, primary key (list_id, list_index))
create table t_map_value (map_id number(10,0) not null, map_value varchar2(255 char), map_key varchar2(255 char) not null, primary key (map_id, map_key))
create table t_set_value (set_id number(10,0) not null, set_value varchar2(255 char))
list,map,array都有联合主键。例如:primary key (map_id, map_key)),primary key (list_id, list_index))
而set却没有约束,那不是可以直接在数据库中插入重复的数据吗?请高手解释
|