使用CrudRepository查询Spring引导时的数据

时间:2015-12-01 11:13:49

标签: java spring spring-boot utf-8

我正在使用Spring启动项目并遇到问题:(

我用过:

public interface Comment1ServiceRepository extends CrudRepository<Comment1, Integer> {
    @Query(value = "SELECT comment1.comment_id,comment1.contribution_id,comment1.user_id,comment1.comment,comment1.photo_id,comment1.stamp_id,comment1.like_count,comment1.update_date,comment1.create_date,comment1.delete_flg,comment1.stamp_place FROM comment1 INNER JOIN contribution1 ON comment1.contribution_id = contribution1.contribution_id WHERE contribution1.location = ?1 LIMIT ?2, ?3", nativeQuery = true)
    List<Comment1> findByPlace( String location, Integer offset, Integer limit);
    @Query(value = "SELECT * FROM comment1  WHERE comment LIKE %:name%", nativeQuery = true)
    List<Comment1> findByName(@Param("name") String name);
}

我提供了一个“村上”的位置参数(所以没有UTF-8字符串) 当我查询它时,它不会返回数据(0行),因为它存在于数据库中

但是当我用UTF-8字符串查询时(例如:“America”),一切正常。

我不知道为什么Spring-boot不能用于非UTF-8。

0 个答案:

没有答案