主键设置int类型递增时,hibernateTemplate.save(o)能插入数据到表中
@Id
@GeneratedValue
private int id;
主键设置String(32)类型时,hibernateTemplate.save(o)不能插入数据到表中,后台也不报错         @Id
@Column(length = 32, nullable = true)
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid")
          private String id;
求解啊我是用hibernate3+spring3.0+sql server2005

解决方案 »

  1.   

    索引集合类(Indexed collections) 
    所有的集合映射,除了set和bag语义的以外,都需要指定一个集合表的索引字段(index column)——用于对应到数组索引,或者List的索引,或者Map的关键字。通过<map-key>,Map 的索引可以是任何基础类型;若通过<map-key-many-to-many>,它也可以是一个实体引用;若通过<composite-map-key>,它还可以是一个组合类型。数组或列表的索引必须是integer类型,并且使用 <list-index>元素定义映射。被映射的字段包含有顺序排列的整数(默认从0开始)。 
      

  2.   

      问题解决了。。   我开始以为是ID粗略的问题,后来发现是业务逻辑没在事务管理范围内, 后来把aop的execution配置正确就问题解决了。。 谢谢大家。。
    结贴咯!