實(shí)體類中的主鍵屬性為啥一定要是ID而不能是id呢?我看老師也是id啊
報(bào)錯(cuò)。我在實(shí)體類中id屬性設(shè)置為 id就會(huì)報(bào)錯(cuò):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又不會(huì)報(bào)錯(cuò)了?
2017-03-20
我記得實(shí)體類(Bean.Message)中的屬性取名稱的時(shí)候,首字母是不能用大寫。
看看你的MessageDao.xml里面在配置的時(shí)候 ?是不是都用了大寫的ID;
貼下你的代碼看看
2017-03-20
應(yīng)該是sql中的別名為ID了吧