^1640764605553
@
sname
key
slabel
key
sdescriptors
xworker.lang.MetaDescriptor3
smany
true
seditCols
2
sinitialization
false
sdescription
我们目前已经见到过<tt class="literal"><font face="新宋体"><key></key></font></tt>元素多次了。 这个元素在父映射元素定义了对新表的连接，并且在被连接表中定义了一个外键引用原表的主键的情况下经常使用。<br /><br />对那些看重删除性能的系统，我们推荐所有的键都应该定义为<tt class="literal"><font face="新宋体">on-delete=&quot;cascade&quot;</font></tt>，这样 Hibernate 将使用数据库级的<tt class="literal"><font face="新宋体">ON CASCADE DELETE</font></tt>约束，而不是多个<tt class="literal"><font face="新宋体">DELETE</font></tt>语句。 注意，这个特性会绕过 Hibernate 通常对版本数据(versioned data)采用的乐观锁策略。 <br /><br /><tt class="literal"><font face="新宋体">not-null</font></tt> 和 <tt class="literal"><font face="新宋体">update</font></tt> 属性在映射单向一对多关联的时候有用。如果你映射一个单向一对多关联到非空的(non-nullable)外键，你<span class="emphasis"><em>必须</em></span> 用<tt class="literal"><font face="新宋体">&lt;key not-null=&quot;true&quot;&gt;</font></tt>定义此键字段。
sid
key
  @/@not-null
  sname
  not-null
  slabel
  not-null
  sinputtype
  select
  sdescription
  表明外键的字段不可为空(这意味着无论何时外键都是主键的一部分)。
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  not-null
    @/@not-null/@true
    sname
    true
    slabel
    true
    svalue
    true
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sid
    true
    @/@not-null/@false
    sname
    false
    slabel
    false
    svalue
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sid
    false
  @/@foreign-key
  sname
  foreign-key
  slabel
  foreign-key
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  foreign-key
  @/@property-ref
  sname
  property-ref
  slabel
  property-ref
  sdescription
  表明外键引用的字段不是原表的主键(提供给遗留数据)。
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  property-ref
  @/@column
  sname
  column
  slabel
  column
  sdescription
  外键字段的名称。也可以通过嵌套的 <tt class="literal"><font face="新宋体">&lt;column&gt;</font></tt>指定。
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  column
  @/@on-delete
  sname
  on-delete
  slabel
  on-delete
  sinputtype
  select
  sdefault
  noaction
  sdescription
  表明外键关联是否打开数据库级别的级联删除。
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  on-delete
    @/@on-delete/@cascade
    sname
    cascade
    slabel
    cascade
    svalue
    cascade
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sid
    cascade
    @/@on-delete/@noaction
    sname
    noaction
    slabel
    noaction
    svalue
    noaction
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sid
    noaction
  @/@unique
  sname
  unique
  slabel
  unique
  sinputtype
  select
  sdescription
  表明外键应有唯一性约束 (这意味着无论何时外键都是主键的一部分)。
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  unique
    @/@unique/@true
    sname
    true
    slabel
    true
    svalue
    true
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sid
    true
    @/@unique/@false
    sname
    false
    slabel
    false
    svalue
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sid
    false
  @/@update
  sname
  update
  slabel
  update
  sinputtype
  select
  sdescription
  表明外键决不应该被更新(这意味着无论何时外键都是主键的一部分)。
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  update
    @/@update/@true
    sname
    true
    slabel
    true
    svalue
    true
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sid
    true
    @/@update/@false
    sname
    false
    slabel
    false
    svalue
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sid
    false
  @/@column1
  sname
  column
  slabel
  column
  sdescriptors
  xworker.lang.MetaDescriptor3/@thing
  sextends
  xworker.hibernate.hibernate-mapping-nodes.column
  smany
  true
  seditCols
  2
  sinitialization
  false
  sid
  column1
