1. 程式人生 > >springboot-jpa報錯No identifier specified for entity:

springboot-jpa報錯No identifier specified for entity:

No identifier specified for entity:。
百度解決方案全是@Id和@GeneratedValue註解不要加在setId()方法上,要加在get方法上,試了還是未解決。

原來是@Id註解import錯包了。

錯誤:

import org.springframework.data.annotation.Id;
正確:

import javax.persistence.*;