试试这个方法
@Entitypublic class MyClass{ @Id @GeneratedValue(generator = “UUID”) @GenericGenerator( name = “UUID”, strategy = “org.hibernate.id.UUIDGenerator”, ) @Column(name = “id”, updatable = false, nullable = false) private UUID id; …}
=====================================
我这样调用,在我的环境中,一切正常:
@Autowiredprivate EntityManager entityManager;@PostMapping("")@Transactionalpublic void add(@RequestBody MyClass myClass){ entityManager.persist(myClass);}
并要求通过邮件与正文一起发送:
{ "myId" : "213b2bbb1"}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)