自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 Spring整合Hibernate----详细

1.导包导入数据库驱动的包hibernate(版本5.4)的包:(required文件夹下的所有包,由于我用c3p0因此也加入了optional文件夹下的c3p0文件夹的包):hibernate核心包c3p0的包导入Spring(版本5)的包:(这里还有个日志包commons-logging-1.2.jar,我就不另外截屏了)编写spring 配置文件:<!-- 使用c3p0数据源 --> <bean id="DataSource" class="com.mcha

2020-07-26 18:48:44 631

原创 使用log4j打印mybatis日志信息

以下方法参考mybatis的官网文件;1.下载jar包(可以去maven下载)2.在mybatis配置信息加入以下内容注意:标签需要按以下顺序来:(properties?, settings?, typeAliases?, typeHandlers?, objectFactory?,objectWrapperFactory?, reflectorFactory?, plugins?, environments?, databaseIdProvider?, mappers?)<settin

2020-07-19 17:34:00 676

原创 mybtis使用like的时候报错:Parameter index out of range (1 > number of parameters, which is 0).]...

经过一番找资料和排查,最终确定了是#{}和${}的使用区别;下面讲一下报错的原因。我们都知道#{}用的是预编译的方法,因此自动转换成相应的类型,当类型为char类型的时候,就会自带引号,因此,当使用like的时候条件就变成了:'%#{xxx}%' //这是mybatis的内容'%'xxx'%'; //这个是转换过后的内容为此,特地的去尝试了以下${}是不是不带引号的,因此测试了以下sql语句,当我直接将${}赋值给char类型的时候,便会报错,而当我在’${}'这样表示的时候便会成

2020-07-19 16:57:52 270

原创 报错:Server Tomcat v8.5 Server at localhost failed to start,但是只影响个别项目

这个错误导致整个项目都运行不起来,但是其他项目可以运行查看控制台后:有这样一句话:Invalid <url-pattern> Car_insert in servlet mapping而后便检查了servlet里的url映射,发现写错了://正确写法:@WebServlet(urlPatterns = { "/Car_insert", "/Car_findAll" })//错误写法:@WebServlet(urlPatterns = { "Car_insert", "/Car_f

2020-07-17 17:48:59 195

原创 A query was run and no Result Maps were found for the Mapped Statement........

该错误类型为:A query was run and no Result Maps were found for the Mapped Statement ‘org.com.mybatisMapper.goodsMapper.queryOrderById’. It’s likely that neither a Result Type nor a Result Map was specified错误原因:在使用mybatis的时候忘了给查询语句设置返回类型了,设置一下即可...

2020-07-16 11:26:46 333

原创 使用SQLyog连接数据库报错:cliset does not support authentication....

在连接数据库的时候报了这个错误:(我数据库是8版本,因为8版本后,密码的安全策略,因此需要将密码修改的稍微复杂一点才行)修改密码代码:use mysql;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xxxxxxx'; //设置的复杂一点如果在修改密码的时候报一下错误:operation alter user failed for root @ localhost则步骤改为:use mysq

2020-07-14 22:05:42 308 1

原创 No suitable driver found for jdbc:mysql.....

今天发现了这样一个错误,这个是提示驱动没有加载成功(也有可能是其他的错误因此),我这里的话,检查一下Class.forName语句是否起作用,并且代码是否有写错

2020-07-13 14:14:05 424 1

原创 解决mybatis查询时间的时候多出一个0

我数据库时间类型为Timestamp,查询后的时间多了个0;解决办法有如下:1.将时间转换成字符串,并截取所需要的部分:String time = date.toString();time.substring(0, time.indexOf("."));2:.使用SimpleDateFormat将字符串格式化:SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String time = sdf.format(d

2020-07-12 16:45:17 2700 1

原创 this is incompatible with sql_mode=only_full_group_by

mysql报以下的错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=o

2020-07-07 14:57:58 1159

原创 Unknown column ‘xxx’ in ‘field list‘

我这里是少加了引号,双引号或者单引号均可以;因为在sql语句里,字符串类型是需要用单引号或者双引号括起来的。使用update语句的时候,遇到这个错。原来的sql语句是:"update user set username="+username+",password="+password+",balance="+balance+"where username=?"; 更改后的语句:"update user set username='"+username+"',password='"+passwor

2020-07-02 16:40:57 239

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除