No identifier specified for entity

今天練習springboot項目搭建,建完實體類也加了jpa註解,可是啓動一直報錯。java


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

終於看到這篇文章,http://blog.csdn.net/qq_33240946/article/details/52916532。springboot

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

錯誤:.net

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

import javax.persistence.*;ci

---------------------
做者:2YSP
來源:CSDN
原文:https://blog.csdn.net/stupid_java_learner/article/details/78346820
版權聲明:本文爲博主原創文章,轉載請附上博文連接!get

相關文章
相關標籤/搜索