第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

簡(jiǎn)單的Spring @CreatedDate注釋對(duì)我不起作用

簡(jiǎn)單的Spring @CreatedDate注釋對(duì)我不起作用

躍然一笑 2021-04-06 15:18:51
我正在嘗試運(yùn)行以下簡(jiǎn)單示例,但出現(xiàn)錯(cuò)誤。我正在使用@CreatedDate。但是,當(dāng)我使用Rest端點(diǎn)保存Student對(duì)象時(shí),它不會(huì)創(chuàng)建日期并拋出給定的異常。在我的休息終點(diǎn),我有 @PostMapping("/students") public Student createStudent(@Valid @RequestBody Student student){    return studentRepository.save(student); }這是我的實(shí)體...@Entity@Table(name = "students")@EntityListeners(AuditingEntityListener.class)@JsonIgnoreProperties(value = {"createdAt", "updatedAt"}, allowGetters = true)public class Student implements Serializable {    @Id    @GeneratedValue(strategy = GenerationType.AUTO)    private Long id;    @NotBlank    private String name;    @NotBlank    private String surname;    @Column(nullable = false, updatable = false)    @Temporal(TemporalType.TIMESTAMP)    @CreatedDate    private Date createdAt;    @Column(nullable = false)    @Temporal(TemporalType.TIMESTAMP)    @LastModifiedDate    private Date updatedAt;
查看完整描述

1 回答

?
慕沐林林

TA貢獻(xiàn)2016條經(jīng)驗(yàn) 獲得超9個(gè)贊

您可能會(huì)錯(cuò)過(guò)Configuration類中的@EnableJpaAuditing批注,該批注在Spring JPA中啟用審核。


查看完整回答
反對(duì) 回復(fù) 2021-04-18
  • 1 回答
  • 0 關(guān)注
  • 981 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)