public static String getUuid() {
String s = UUID.randomUUID().toString();
// 去掉"-"符号的UUID
return s.replace("-", "").trim();
}
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)//针对数据库 主键自动增长的
@Id
@GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid",strategy="uuid")//使用uuid的主键注解
使用UUID 出现detached entity passed to persist 这种错误是因为你的主键id已经有值了 所以报错 在jsp页面不要定义他name