目录 SpringBoot 整合 PostGreSQL 一.PostGreSQL简介 二.关于 SpringDataJPA 三.整合 PostGreSQL A. 依赖包 B. 配置文件 C. 模型定义 D. 持久层 E. Service 层 四.高级操作 小结 SpringBoot 整合 PostGreSQL 一.PostGreSQL简介 PostGreSQL是一个功能强大的开源对象关系数据库管理系统(ORDBMS),号称世界上最先进的开源关系型数据库 经过长达15年以上的积极开发和不断改进,P
原文地址:https://blog.csdn.net/weixin_40326509/article/details/80865646 在使用springboot中,需要使用JPQL和SQL去查询记录. 获取一整条记录,返回的类型就是对应的实体类或者实体类的集合. 当不是全部字段时,返回类型就不能是实体类了. 以下是用JPQL和SQL获取单个字段或多个字段的返回类型: JPA查询单个字段: @Query(value="select age from User u where u.name=?1&
问题与分析 某日忽然发现在用postman测试数据时报错如下: com.fasterxml.jackson.databind.JsonMappingException: could not initialize proxy [com.cbxsoftware.cbx.attachment.entity.RefAttachment#c109ec36e60c4a89a10eabc72416d984] - no Session (through reference chain: com.cbxsoftw
spring data jpa查询部分字段 第一种方法:使用 model 查询时转化 首先建立一个 model ,写上自己想要查询的字段,然后写上构造函数,这步很重要,因为spring jpa 转化时会调用这个构造方法 public class MyModel implements Serializable { private String userName; private String name; private String gender; private String descripti
spring-boot jpa mysql utf8mb4 emoji 写入失败 mysql database,table,column 默认为utf8mb4 Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\xAD' for column 'title' at row 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)