實體類中的主鍵屬性為啥一定要是ID而不能是id呢?我看老師也是id啊
報錯。我在實體類中id屬性設置為 id就會報錯:Error querying database. ?Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'ID' of 'class com.cml.Bean.Message' with value '2' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'ID' in 'class com.cml.Bean.Message'
### The error may exist in com/cml/config/sqlxml/MessageDao.xml
改成ID又不會報錯了?
2017-03-20
我記得實體類(Bean.Message)中的屬性取名稱的時候,首字母是不能用大寫。
看看你的MessageDao.xml里面在配置的時候 ?是不是都用了大寫的ID;
貼下你的代碼看看
2017-03-20
應該是sql中的別名為ID了吧