陈创
2017-08-21 02:46使用MySQL和JPA映射时,来源不同的请求,产生不同的结果?
数据库使用MySQL,字段类型MEDIUMBLOB,连接配置为: spring.datasource.url=jdbc:mysql://localhost:3306/mydatabse?useUnicode=true&characterEncoding=utf-8
映射框架使用Spring JPA,对应的Java类型是String;
数据库中的数据中含特殊字符,如:·Line of Credit and Security Agreement
当请求来自本地,对应映射到的String是:·Line of Credit and Security Agreement
当请求来自AWS SQS时,对应映射到的String是:·Line of Credit and Security Agreement(多了个Â)
另外,当数据库的连接配置改为 spring.datasource.url=jdbc:mysql://localhost:3306/mydatabse时,两种情况映射到的String是:·Line of Credit and Security Agreement
请问:产生该问题的原因是什么,另如果在不改变数据库连接配置的情况下,怎样让两种方式映射到的String一致,谢谢!
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- Spring集成Hibernate,使用JPA注解方式,新增数据无法提交
- 事务管理
- spring
- hibernate
- jpa
- 0个回答
- Spring + Hibernate4 无法将数据写入数据【请教】
- spring
- hibernate
- 0个回答
- org.hibernate.HibernateException: No Session found for current thread
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 0个回答
- hibernate returning BigInteger instead of Long(hibernate返回java类型为BigInteger)
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 0个回答
- 我的数据库里的id是smallint类型,映射到实体里是Short类型,我按ID查询怎么传值?
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 0个回答
换一换