hib.xml 映射文件
<id name="aid" type="java.lang.String">
<column name="Aid" />
<generator class="guid" />
</id>
guid 表示 id自动,且是newid() 填写内容
native 其实这个native并非实际的类型,而是hiberante根据当前使用的数据库,自动使用对应的类型。如果sqlserver,native就对应identity。mysql,就对应为increment
uuid 使用uuid.hex产生的随机32位数最为主键,那么数据库的id字段类型为char,长度为32
assigned:用户自定义id;
不要为现在着想,要为将来!

浙公网安备 33010602011771号