zoukankan      html  css  js  c++  java
  • pilipili在线视频网站开发日志(一)

     模仿bilibili做了一个pilipili在线视频网站

    源码已全部托管至github:https://github.com/BrucessKING/pilipili

    我主要负责接口的实现

    leader给了我两个接口:UserDao VideoDao

    使用的框架为SSM

    今天遇到的错误问题:

    1 org.apache.ibatis.exceptions.PersistenceException: 
    2 ### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc, releaseDate, clickTimes, pictureUrls, videoUrl, state, user_id, category_i' at line 1
    3 ### The error may involve defaultParameterMap
    4 ### The error occurred while setting parameters
    5 ### SQL: insert into p_video(name, desc, releaseDate, clickTimes, pictureUrls, videoUrl, state, user_id, category_id) values(?, ?, ?, ?, ?, ?, ?, ?, ?)
    6 ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc, releaseDate, clickTimes, pictureUrls, videoUrl, state, user_id, category_i' at line 1

    明明没有语法错误,可是仍然报错。。。

    后来发现,在建表时,居然使用了desc关键字作为列名

    解决的方法为:使用反单引号把desc引起来

    sql语句如下:

     1 insert into p_video(`name`, `desc`, releaseDate, clickTimes, pictureUrls, videoUrl, state, user_id, category_id) values(#{video.name}, #{video.desc}, #{video.releaseDate}, #{video.clickTimes}, #{video.pictureUrls}, #{video.videoUrl}, #{video.state}, #{user_id}, #{category_id}) 

    2019-12-26 15:30

    报错如下:

    1 org.apache.ibatis.exceptions.PersistenceException: 
    2 ### Error querying database.  Cause: java.lang.UnsupportedOperationException
    3 ### The error may exist in file [D:Git_Repositorypilipili	argetclassesmapperVideoDao.xml]
    4 ### The error may involve com.pilipili.dao.VideoDao.selectVideosByClickTimes
    5 ### The error occurred while handling results
    6 ### SQL: select id, `name`, `desc`, releaseDate, clickTimes, pictureUrls, videoUrl, state, user_id, category_id from p_video where user_id=? order by clickTimes desc limit 0, ?
    7 ### Cause: java.lang.UnsupportedOperationException

    原因是在 VideoDao.xml 中 resultType="list"

    即使要返回list类型,这里也应该写成video类型,如果查询到多条数据,会自动放入list中

    特此鸣谢:https://blog.csdn.net/zhanyu1/article/details/82557357

    金麟岂是池中物,一遇风云便化龙!
  • 相关阅读:
    移动端 (基于jquery的3个)touch插件
    leaflet开源地图库源码 浏览器&移动设备判断(browser.js)备份
    移动端 常见问题整理 iOS下的 Fixed + Input 调用键盘的时候fixed无效问题解决方案
    百度echarts扇形图每个区块增加点击事件
    js 性能优化整理之 缓存变量
    移动端 延迟加载echo.js的使用
    js 性能优化整理之 高频优化
    css整理 background-size优化
    原生js 样式的操作整理
    百度地图展示分公司信息 (针对电视机)
  • 原文地址:https://www.cnblogs.com/ABKing/p/12101233.html
Copyright © 2011-2022 走看看