Error attempting to get column 'content' from result set

linp
  • 9
org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column 'content' from result set.  Cause: java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.NumberFormatException: For input string: "<div class="topic-richtext"> 
 <p>￧ᆱᆵ¥ヘネ₩ネᄋ¥ᄂヨ₩ᄡᄏ¥ハᄄ￯ᄐ゚</p> 
</div>"
; uncategorized SQLException; SQL state [null]; error code [0]; An SQLException was provoked by the following failure: java.lang.NumberFormatException: For input string: "<div class="topic-richtext"> 
 <p>￧ᆱᆵ¥ヘネ₩ネᄋ¥ᄂヨ₩ᄡᄏ¥ハᄄ￯ᄐ゚</p> 
</div>"; nested exception is java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.NumberFormatException: For input string: "<div class="topic-richtext"> 
 <p>￧ᆱᆵ¥ヘネ₩ネᄋ¥ᄂヨ₩ᄡᄏ¥ハᄄ￯ᄐ゚</p> 
</div>"
<select id="queryAllActivity" resultType="Activity">
        select * from campus_entertainment.activity limit 0,10;
    </select>

实体类也是封装了全部的,基本没问题的呀,还有content在mysql的类型是mediumtext,对应java的类型为string,为什么突然就查不出全部了,报错提示content有问题,但是只查一个select content是查得出来了,也不会乱码的,不知道为什么了,求解呀!



太奇怪了,我用万能的Map就可以解决了!!
<resultMap id="SomeActivityMap" type="java.util.HashMap"/>
    <select id="querySomeActivity" resultMap="SomeActivityMap">
        select * from campus_entertainment.activity limit 0,10;
    </select>

只是我想不通啊??

回复
阅读 4.2k
1 个回答

mysql字段属性也就varchar,mediumtext和int,前两个在java里映射的字段都是VARCHAR,后面应该是INTEGER,我在实体类声明Integer和int都试过了,直接查询所有返回Activity类型的就不行,用了map,返回类型是hashmap,也都没设置啥,就可以了???

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
你知道吗?

宣传栏