Spring boot JPA

Spring Boot整合Spring Data JPA详解 Spring Boot整合Spring Data JPA理解 官方文档: Spring Data JPA 官方文档 一、 Sping Data JPA 简介 在此之前我们首先来认识一下,**Spring Data JPA** 是 Spring 基于 ORM 框架、JPA 规范的基础上封装的JPA 应用框架,底层使用了 Hibernate 的 JPA 技术实现,Spring Data JP... 阅读详情

Spring boot JPA

上一节 Spring boot mybatis

Spring boot mybatis

源码

spring boot all


JPA简介

Spring Data JPA为Java Persistence API(JPA)提供了存储库支持。它简化了需要访问JPA数据源的应用程序的开发。
市面上最常见的是hibernate, spring JPA 大部分也沿用了hibernate 的一些实现。使用上更方便,开箱即用。

springboot 整合JPA

  1. 添加依赖
   <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.47</version>
        </dependency>
  1. 配置文件
    配置好datasouce 和 jpa的一些配置
spring:
  application:
    name: jap-demo
    # 配置数据源
  datasource:
    url: jdbc:mysql://localhost:3306/mytest?useSSL=false&charsetEncoding=utf8
    username: root
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver
  jpa:
    hibernate:
      # 是否自动创建表结构, 等同于 hibernate.hbm2ddl.auto
      ddl-auto: create-drop
#      naming:
#        physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
    # 打印sql
    show-sql: true
    properties:
      # 格式化 sql
      hibernate:
        format_sql: true

logging:
  level:
    ## 打印sql参数,记得日志级别一定设置为 trace
    org.hibernate.type.descriptor.sql.BasicBinder: trace

jpa 的一些配置,有很大一部分使用hibernate。

  1. 代码示例
创建实体类
沿用Java Persistence API 进行实体类创建和声明, 创建 productEntity 实体;
@Table 对应了数据库表
@entity 标注为数据库表对应的实体
@Id 表明为 id自动
@Column(length = 32) 表字段的映射和设置
@Table(name = "t_product")
@Entity(name = "product")
public class ProductEntity {


    @Id
    @Column(length = 32)
    private String pId;

    @Column(length = 255, nullable = false)
    private String pName;

    @Column(nullable = false)
    private Long price;

    @Column
    private Date scDate;

开启repository

@EnableJpaRepositories(basePackages = {"com.xiaodu.jpa.repository"})

定义repository接口
jpa 默认提供的 repository 的继承树
在这里插入图片描述
CrudRepository: 提供了增删改查功能的方法
PagingAndSortingRepository: 提供了分页和排序功能
QueryByExampleExecutor: 提供了使用 Example 构建查询条件
JpaRepository: 集成了上面所有的 功能; 所以我们一般继承JapRepository 即可

使用 CurdRepository
@Repository  // 可加可不加,我们已经使用EnableJpaRepositories(basePackages = {"com.xiaodu.jpa.repository"})扫描
public interface ProductRepository extends CrudRepository<ProductEntity, String> {}

crudRepository 内置方法使用


    private void testCrudRepository() {
        ProductEntity p = new ProductEntity();
        p.setPrice(199900L);
        p.setpName("xiaomi 11");
        p.setScDate(new Date());
        String id = UUID.randomUUID().toString().replaceAll("-", "");
        p.setpId(id);
        // 添加
        productRepository.save(p);
        // 查询
        Optional<ProductEntity> byId = productRepository.findById(id);
        // count
        long count = productRepository.count();
        // 修改
        p.setPrice(299900L);
        productRepository.save(p);
        // 删除
//        productRepository.deleteById(id);
        
    }

curd 提供的所有方法
在这里插入图片描述

使用 PagingAndSortingRepository

PagingAndSortingRepository 提供的方法 增加参数 pageable 和 sort

@Repository
public interface ProductRepository extends PagingAndSortingRepository<ProductEntity, String> {}

使用示例

    private void testPagingAndSortingRepository() {
        // 排序
        productRepository.findAll(Sort.by(Sort.Order.desc("scDate")));

        // 分页加排序
        productRepository.findAll(PageRequest.of(1, 5, Sort.by(Sort.Order.desc("scDate"))));

    }
使用 JpaRepository 和 QueryByExampleExecutor

JpaRepository 提供了PagingAndSortingRepository 和crudRepository 的所有方法 ,所以和上面的示例一样;
这里主要说明下 QueryByExampleExecutor 的使用
(JpaRepository 继承了 QueryByExampleExecutor )

public interface ProductRepository extends
        /*CrudRepository*/
        /*PagingAndSortingRepository*/
        JpaRepository<ProductEntity, String> {}

QueryByExampleExecutor示例代码
使用ExampleMatcher 构建 条件Example;
如下示例:通过 Example 进行构建简单的查询条件 和使用ExampleMatcher模糊查询

  private void testJpaRepository() {
        //test QueryByExampleExecutor; 使用Example 构建条件
        //Example 只能对 string 类型进行匹配查询,并且是有限的; 使用上了解即可
        ProductEntity p = new ProductEntity();
        p.setPrice(199900L);
        p.setpName("xiaoMi");
        // where price = ? and p_name = ?
        List<ProductEntity> productEntities = productRepository.findAll(Example.of(p));

        // 使用ExampleMatcher  构建like;  where price = 199900 or  p_name like ? escape ?
        ExampleMatcher exampleMatcher = ExampleMatcher.matchingAny()
                .withMatcher("pName", ExampleMatcher.GenericPropertyMatchers.contains());
        List<ProductEntity> productList = productRepository.findAll(Example.of(p, exampleMatcher));

    }

自定义查询方法

JPA 可以通过解析方法名来生产sql语句,并不需要任何实现只需要方法命名按照jpa规范和关键字命名即可。

使用示例
例如在 repository 接口中声明方法

// 批量查询,p_name like {#pName} and price >= #{price}
    List<ProductEntity> findAllByPNameLikeAndPriceGreaterThanEqual(String pName, Long price);

若想分页或排序只需要在参数中添加Pageable分页 或者 Sort 排序

List findAllByPNameLikeAndPriceGreaterThanEqual(String pName, Long price, Pageable pageable);

注意:参数Sort和Pageable不能为null。如果不想应用任何排序或分页,请使用Sort.unsorted()和Pageable.unpaged()

限制查询结果

返回值可以使用Streamable 代替集合;也可使用java 8 的充当返回值。 甚至可以使用异步查询,使用 Future, completableFure,ListenableFuture 充当返回值进行异步查询;
具体请参考jpa 官方文档。

@Async
Future<User> findByFirstname(String firstname);     

查询方法关键字和修饰符

关键字方法样例生成的jpsql样例
DistinctfindDistinctByLastnameAndFirstnameselect distinct …​ where x.lastname = ?1 and x.firstname = ?2
AndfindByLastnameAndFirstname… where x.lastname = ?1 and x.firstname = ?2
OrfindByLastnameOrFirstname… where x.lastname = ?1 or x.firstname = ?2
Is, EqualsfindByFirstname,findByFirstnameIs,findByFirstnameEquals… where x.firstname = ?1
BetweenfindByStartDateBetween… where x.startDate between ?1 and ?2
LessThanfindByAgeLessThan… where x.age < ?1
LessThanEqualfindByAgeLessThanEqual… where x.age <= ?1
GreaterThanfindByAgeGreaterThan… where x.age > ?1
GreaterThanEqualfindByAgeGreaterThanEqual… where x.age >= ?1
AfterfindByStartDateAfter… where x.startDate > ?1
BeforefindByStartDateBefore… where x.startDate < ?1
IsNull, NullfindByAge(Is)Null… where x.age is null
IsNotNull, NotNullfindByAge(Is)NotNull… where x.age not null
LikefindByFirstnameLike… where x.firstname like ?1
NotLikefindByFirstnameNotLike… where x.firstname not like ?1
StartingWithfindByFirstnameStartingWith… where x.firstname like ?1(参数附后%)
EndingWithfindByFirstnameEndingWith… where x.firstname like ?1(参数加前缀%)
ContainingfindByFirstnameContaining… where x.firstname like ?1(参数绑定在中%)
OrderByfindByAgeOrderByLastnameDesc… where x.age = ?1 order by x.lastname desc
NotfindByLastnameNot… where x.lastname <> ?1
InfindByAgeIn(Collection ages)… where x.age in ?1
NotInfindByAgeNotIn(Collection ages)… where x.age not in ?1
TruefindByActiveTrue()… where x.active = true
FalsefindByActiveFalse()… where x.active = false
IgnoreCasefindByFirstnameIgnoreCase… where UPPER(x.firstname) = UPPER(?1)
使用 Specification 进行复杂条件构建

Specification 提供了 比Example 更丰富的复杂查询条件的构建. 如果是复杂sql 还是不太直观。
首先我们要继承 JpaSpecificationExecutor

@Repository
public interface ProductRepository extends
        /*CrudRepository*/
        /*PagingAndSortingRepository*/
        JpaRepository<ProductEntity, String>,
        JpaSpecificationExecutor<ProductEntity> {}

使用示例

  ProductEntity p = new ProductEntity();
        p.setpName("xiaomi");
        p.setPrice(1000L);
        List<ProductEntity> all = productRepository.findAll(Specification.where((root, query, criteriaBuilder) -> {
            Predicate pName = criteriaBuilder.like(root.get("pName"), "%" + p.getpName() + "%");
            return criteriaBuilder.and(pName, criteriaBuilder.or(criteriaBuilder.lessThan(root.get("price"), 29900L),
                    criteriaBuilder.greaterThan(root.get("price"), p.getPrice())));
        }));
        /*
         *     select
         *         productent0_.p_id as p_id1_0_,
         *         productent0_.p_name as p_name2_0_,
         *         productent0_.price as price3_0_,
         *         productent0_.sc_date as sc_date4_0_
         *     from
         *         t_product productent0_
         *     where
         *         (
         *             productent0_.p_name like '%xiaomi%'
         *         )
         *         and (
         *             productent0_.price<29900
         *             or productent0_.price>1000
         *         )
         */

需要分页的话 需要添加参数 pageable ,排序加sort

    // 分页查询

        productRepository.findAll((root, query, cb) -> {
            Path<String> pName = root.get("pName");
            Path<Long> price = root.get("price");
            return cb.and(cb.or(cb.greaterThan(price, 199900L), cb.lessThan(price, 399900L)), cb.like(pName, "%xiaomi%"));
        }, PageRequest.of(1, 5));
        /*
         *  select
         *         productent0_.p_id as p_id1_0_,
         *         productent0_.p_name as p_name2_0_,
         *         productent0_.price as price3_0_,
         *         productent0_.sc_date as sc_date4_0_
         *     from
         *         t_product productent0_
         *     where
         *         (
         *             productent0_.price>199900
         *             or productent0_.price<399900
         *         )
         *         and (
         *             productent0_.p_name like ?
         *         ) limit ?, ?
         */
使用@Query

有时候需要更直观的显示出sql, 我们也可以使用@query注解来编写sql语句

hql 和参数占位
    // hql 语句  表名即实体名若用了@Entity 指定则是@Entity指定的名称
    @Query("select p from product p")
    List<ProductEntity> selectAll();

    // hql  带参数; 使用 ?index 进行占位符
    @Query("select p from product p where p.price = ?1")
    List<ProductEntity> selectByPrice(Long price);
    // hql 使用 :field 参数占位符
    @Query("select p from product p where p.price = :price")
    List<ProductEntity> selectByPrice2(@Param("price") Long price);

sql 和参数占位

默认都是使用的 hql 语句,若使用 原生的 需要指定nativeQuery = true

  // 使用原生sqlsql
    @Query(value = "select * from t_product", nativeQuery = true)
    List<ProductEntity> selectAlls();
    // 使用 ?index 接收参数
    @Query(value = "select * from t_product where p_name = ?1", nativeQuery = true)
    List<ProductEntity> selectByName(String pName);

    // 使用 :field 接收
    @Query(value = "select * from t_product where p_name = :pName", nativeQuery = true)
    List<ProductEntity> selectByName2(@Param("pName") String pName);

分页
分页和排序一样,传递 pageable, 或者 sort

 // 分页查询, 需要传递 pageable
    @Query("select p from product p where p.price = :price")
    Page<ProductEntity> pageByPrice(@Param("price") Long price, Pageable pageable);

对象参数
若参数是一个对象,则使用 :#{#obj.field} 占位,可使用 @param 指定

  // 接收对象  使用 :#{#field} 接收
    @Query(value = "select * from t_product where p_name = :#{#product.pName}", nativeQuery = true)
    List<ProductEntity> selectByName3(@Param("product") ProductEntity productEntity);

执行updpate ,insert, delte 语句,需要使用@Modifying 修饰,并且需要添加事务@Transactional

  // 执行update insert delete  语句,需要加上@Modifying  和 @Transactional 语句
    @Transactional(timeout = 10)
    @Query("update product set pName = :#{#productEntity.pName} where pId = :#{#productEntity.pId}")
    @Modifying
    int updateProductNameById(@Param("productEntity") ProductEntity productEntity);
多表关联查询

jpa 多表关联查询, 第一种方式可以使用一个 实体类包含所查询的参数,然后使用 @query 进行查询 ;这个比较简单;
实体封装了所有查询的数据, @query 返回锁查询的字段信息

我们使用注解方式

@OneToOne
一对一关系映射
@OneToMany
一对多关系映射
@ManyToOne
多对一关系映射
@ManyToMany
多对多关系映射

我们使用 order 订单 和 product 产品 进行关系映射示例; 一个订单包含多个商品 oneToMany,多个商品可以在一个订单中ManyToOne 。
orderEntity 中我们声明关系; oneToMany 声明这是一对多的关系,casade 级联的策略,fetch 声明获取是懒加载还是立即查询加载;
@JoinColumn 声明和 product 之前的外键关联, 项目启动后生成的product 会有外键order_no 和 order中的order_no 外键关联

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
// 外键关联,会在 product 表中生产order_no字段;
	@JoinColumn(name = "orderNo", referencedColumnName = "orderNo")
    private Set<ProductEntity> productEntities;

我们还可以采取中间表的方式建立关系

@JoinTable; name 指定了中间表,会自动创建中间表; joinColumns 指定了 order 和中间表的关联键, inverseJoinColumns
指定了 中间表和 product 之前的关联键

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    // 会自动创建中间表 order_product,通过 joinColumns 中关联了自己的orderNo
    // 和中间表的orderNo(referencedColumnName引用自己的那个字段)
    // 通过inverseJoinColumns 关联了 中间表和关联的Product 表的字段关系
    @JoinTable(name = "order_product", joinColumns = {@JoinColumn(name = "orderNo", referencedColumnName = "orderNo")},
            inverseJoinColumns = {@JoinColumn(name = "pId", referencedColumnName = "pId")})
    private Set<ProductEntity> productEntities;

同样若product也需要查询order 信息;则在product 中指定关系

 @ManyToOne
    @JoinTable(name = "order_product", joinColumns = {@JoinColumn(name = "pId", referencedColumnName = "pId")},
            inverseJoinColumns = {@JoinColumn(name = "orderNo", referencedColumnName = "orderNo")})
    private OrderEntity orderEntity;
使用 Querydsl 进行复杂查询

JPA提供的条件查询豆太过于复杂也不太好看。我们可以使用Querydsl 进行复杂查询;
querydsl官网

使用示例

  1. 添加依赖
  <!-- https://mvnrepository.com/artifact/com.querydsl/querydsl-jpa -->
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
            <version>4.1.4</version>
        </dependency>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
            <version>4.1.4</version>
            <scope>provided</scope>
        </dependency>
  1. 添加插件
    <build>
        <plugins>
            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources/java</outputDirectory>
                            <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

添加完插件后 maven compiler 下 ;编译下项目,会生成实体对应的 Q实体;

  1. 代码示例
    private void testQuerydsl() {
        JPAQueryFactory jpaQueryFactory = new JPAQueryFactory(entityManager);
        // querydsl 生成的QProductEntity
        QProductEntity productEntity = QProductEntity.productEntity;

        ProductEntity xiaomi = jpaQueryFactory.selectFrom(productEntity)
                .where(productEntity.pName.eq("xiaomi")
                        .and(productEntity.price.lt(2999)
                                .or(productEntity.price.gt(1999))))
                .fetchOne();// fetch 执行sql语句,查询单个

        /*
         *     select
         *         productent0_.p_id as p_id1_2_,
         *         productent0_.p_name as p_name2_2_,
         *         productent0_.price as price3_2_,
         *         productent0_.sc_date as sc_date4_2_,
         *         productent0_1_.order_no as order_no1_0_
         *     from
         *         t_product productent0_
         *     left outer join
         *         order_product productent0_1_
         *             on productent0_.p_id=productent0_1_.p_id
         *     where
         *         productent0_.p_name=?
         *         and (
         *             productent0_.price<?
         *             or productent0_.price>?
         *         )
         **/
    }

更多的使用方式 还请查询官网。


下一节 Spring boot 多数据源和动态数据源

Spring boot 多数据源和动态数据源

Spring Boot 7:Spring Boot整合JPA 文章目录一、正文Spring Data JPASpring Boot整合JPA1、创建Spring Boot项目2、添加项目依赖3、设置项目名称和保存位置4、创建ORM实体类1)创建评论实体类Comment2)创建文章实体类Article5 、创建接口6、添加数据源依赖1) pom.xml中添加阿里巴巴数据源依赖2)在全局配置文件里配置数据源3)编写测试方法- testFindAll()4)其他测试方法- test...利用JPA实现个性化操作1、 一、正文 Spring Data JPA 它是Spri 阅读详情

相关推荐

Spring Boot JPA 常见的那些坑

前言 之前讲解了Spring Boot如何集成JPA和相关特性,虽然JPA使用非常的简单,但是我们在实际的 项目中需要去掌握JPA原理,这样才能更好的解决相关问题。 JPA为什么没有update方法 JPA提供了一个save方法,当主键为空的时候,则执行的为insert语句,当主键不为空的时候,则执行为update方法。 JPA使用Save方法的坑 问题1:需要区分Save方法什么时候执行的insert,什么时候执行的为update语句,切莫误把insert当作了update。 先看下JPA s

uuqaz的博客 1526

JPA--动态查询--Example

其他网址

IT利刃出鞘的博客 1万+

【Spring Boot】在Spring Boot项目中使用JPA

JpaRepository是Spring Data JPA中非常重要的类。它继承自Spring Data的统一数据访问接口——Repository,实现了完整的增、删、改、查等数据操作方法。JpaRepository提供了30多个默认方法,基本能满足项目中的数据库操作功能。JpaRepository是实现Spring Data JPA技术访问数据库的关键接口。

衍生星球的博客 1285

SpingDataJPA之ExampleMatcher实例查询

ExampleMatcher是SpingData-JPA中好玩的一个东西 ExampleMatcher实例查询三要素 实体对象:在ORM框架中与Table对应的域对象,一个对象代表数据库表中的一条记录,如上例中User对象,对应user表。在构建查询条件时,一个实体对象代表的是查询条件中的“数值”部分。如:要查询姓“X”的客户,实体对象只需要存储条件值“X”。 匹配器:ExampleMa...

★【World Of Moshow 郑锴】★ 5万+

Spring Boot Jpa 的使用 | Spring Boot 5

一、Spring Boot Jpa简介 Jpa(Java Persistence API)是sun官方提出的java持久化规范。它为java开发人员提供了一种对象/关联映射工具,来管理java应用中的关系数据。它的出现主要是为了简化现有的持久化开发工作和整合ORM技术,结束现在hibernate、toplink、jdo等ORM框架各自为营的局面。 值得注意的是,Jpa是在充分吸收了现有ORM框...

学Java,找哪吒 5358

实现 PDF 添加水印的五种方式

PDF(Portable Document Format,便携式文档格式)是一种流行的文件格式,它可以在多个操作系统和应用程序中进行查看和打印。在某些情况下,我们需要对 PDF 文件添加水印,以使其更具有辨识度或者保护其版权。本文将介绍如何使用 Spring Boot 来实现 PDF 添加水印的方式。

逸轩 6470

jpa+ExampleMatcher分页+springboot项目

jpa+ExampleMatcher分页+springboot项目

m0_72049986的博客 419

ESWA投稿全流程避坑指南:从LaTeX模板到审稿状态查询(附最新资源链接)

本文提供了一份详尽的ESWA期刊投稿全流程指南,涵盖从LaTeX模板深度适配、Cover Letter撰写,到Editorial Manager系统操作、审稿状态解析等关键环节。重点解析了投稿准备中的常见“雷区”与文件合规性要求,并分享了收到审稿意见后的高效修改与回复策略,旨在帮助研究者规避流程陷阱,提升投稿效率与成功率。

9o8p7i6u5y的博客 838

别再拼sql了,JPA中还可以使用这几种查询方式

JPA几种查询方式,Example、Specification、Criteria

园区阿祖的博客 1540

一文说清Arduino如何实现舵机平滑转动(机器人场景)

深入讲解如何利用arduino控制舵机转动,实现机器人场景中的平稳运动。通过代码优化与脉冲宽度调节,让舵机动作更精准流畅,适用于各类自动化项目。

weixin_35706255的博客 897

SSE消息推送避坑指南:从Chrome兼容性到Spring超时配置

本文深入探讨了在Java Spring Boot项目中实现SSE消息推送时,从浏览器兼容性到后端配置的完整避坑指南。针对Chrome并发连接限制、Safari自动断开、Nginx代理缓冲以及Spring SseEmitter内存泄漏与超时管理等生产环境常见问题,提供了具体的解决方案和最佳实践配置,帮助开发者构建稳定可靠的实时推送系统。

work3的博客 449

jpa 多字段like_详解Spring Data Jpa 模糊查询的正确用法

模糊查询Spring Data Jpa的使用可以减少开发者对sql语句的编写,甚至完全不需要编写sql语句。但是,开发过程中总会遇到各种复杂的场景以及大大小小的坑。今天项目中某个功能模块需要用到模糊查询。原生sql中模糊查询关键字‘Like',而Spring Data Jpa的Repository接口中恰恰也有实体字段对应的Like。但是,如果直接使用它,那么恭喜你,你幸运地掉坑了。Spring ...

weixin_39689347的博客 1758

淘宝电商产品价格官方防爬取采集设计机制,如何破?|淘宝电商API数据采集看完你也会!

然而,随着电子商务的蓬勃发展,涌现出大量的第三方工具和应用,试图通过采集淘宝电商产品价格等信息来进行数据分析和竞争优势的获取。为了维护市场秩序和保护商家权益,淘宝采取了一系列的防爬取设计机制,以阻止非授权的数据采集行为。为了确保数据的准确性和及时性,淘宝采取了多层次的防爬取机制,以限制未经授权的数据采集。其它的情况,比如淘宝首页、淘宝关键词商品搜索结果页面、商品详情页面,都是正常展示,未实现加密;也可以使用【tesseract ocr识别】指令,这个是免费无限使用的;【淘宝商品搜索结果页面-本地截图】

TinagirlAPI的博客 1384

spring boot 中使用 jpa以及jpa介绍

最近在项目中使用了一下jpa,发现还是挺好用的。这里就来讲一下jpa以及在spring boot中的使用。 在这里我们先来了解一下jpa。1.什么是jpa呢?JPA顾名思义就是Java Persistence API的意思,是JDK 5.0注解或XML描述对象-关系表的映射关系,并将运行期的实体对象持久化到数据库中。 2.jpa具有什么优势?2.1标准化 JPA 是 JCP 组织发布的 Java

深存少年梦 28万+

黑猫带你学eMMC协议第1篇:全网最全emmc协议中文详讲,这份学习框架图,你值得拥有!!!(持续更新中...)

黑猫带你学eMMC协议第7篇:全网最全emmc写保护详解(write protect) 黑猫带你学eMMC协议第8篇:emmc可靠写详解(Write Reliability) 黑猫带你学eMMC协议第9篇:emmc的分区配置(partitioning) 黑猫带你学eMMC协议第10篇:eMMC命令队列详解(CMDQ) 黑猫带你学eMMC协议第11篇:eMMC擦除详解(erase/trim/discard/sanitize/secure erase/secure trim…) 黑猫带你学eMMC协议第12篇:

黑猫奥利奥的博客 2万+

uniapp [安卓苹果App端] - 在“安卓app/苹果app“平台端打包编译后,微信授权登录报错 login:fail [:-1]未能完成操作。(PGWXAPI错误-1。)错误码code:-10

uni-app,安卓Android,苹果ios,安卓app端,苹果App端,uniapp苹果安卓app,微信授权登录,uniAppAPP端微信登录报错,出现微信确认登录界面后点击登录报错,BundleID,应用ID,微信登录,app微信一键登录,微信登录绑定点确定就出错,AppSecrect,login:fail[:-1]未能完成操作。(PGWXAPI错误-1。),"errCode":-100,"code":-100,在uniappmanifest.json配置了AppSecrect还是报错无

🏆 前端领域优质创作者 3762

Java Web开发进阶——Spring Boot与Spring Data JPA

Spring Data JPA 是 Spring Data 项目中的子项目,旨在简化与 JPA(Java Persistence API)的集成。它在标准 JPA 的基础上提供了更高层次的抽象,开发者可以使用极少的代码实现复杂的数据操作。Spring Data JPA 是 Spring 提供的一种面向数据访问的持久化框架,它简化了 JPA 的实现,为开发者提供了一种快速操作数据库的方式。Spring Data JPA 的强大之处在于其灵活的查询方式,支持方法派生、JPQL 和原生 SQL。

好看资源网的博客 2243

在 Visual Studio Code 中开发 SAP Fiori 应用并部署到 Cloud Foundry 的完整实战指南

摘要:本文介绍如何以ABAP RAP服务为后端,通过VS Code和SAP Fiori工具将Fiori应用一键部署到SAP BTP Cloud Foundry环境。主要内容包括:1) 开发环境配置(VS Code+Fiori工具);2) 架构流程说明(MTA打包、Approuter路由);3) 权限准备(业务Catalog分配);4) 创建带Approuter的MTA项目;5) 连接ABAP OData服务并生成Fiori应用。文中还针对常见问题(如服务不可见、部署失败)提供了解决方案参考。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 360

Spring Boot整合Spring Data JPA

Spring Data中按照框架的规范自定义了Repository接口,除了可以使用接口提供的默认方法外,还可以按特定规则来定义查询方法,只要这些查询方法的方法名遵守特定的规则,不需要提供方法实现体,Spring Data就会自动为这些方法生成查询语句。Spring Data对这种特定的查询方法的定义规范如下:以find、read、get、query、count开头。涉及查询条件时,条件的属性使用条件关键字连接,并且条件属性的首字母大写。

daqi1983的博客 1590

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Spring Boot下的Spring Data JPA实战详解

1.点睛Spring Data JPA(1).什么名字是Spring Data JPA Spring Data JPA是Spring基于Hibernate开发的一个JPA框架,Spring Data JPA是Spring Data的一个子项目,它通过提供基于JPA的Repository极大地减少了JPA作为数据访问方案的代码量,也就是xml不需要再写很多常规的sql代码了。(2).定义数据访问层

c136547731的博客 2809

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Spring Boot(三):Spring Boot Jpa的介绍及Jpa的使用

Spring Boot Jpa 介绍 首先了解 Jpa 是什么? Jpa (Java Persistence API) 是 Sun 官方提出的 Java 持久化规范。它为 Java 开发人员提供了一种对象/关联映射工具来管理 Java 应用中的关系数据。它的出现主要是为了简化现有的持久化开发工作和整合 ORM 技术,结束现在 Hibernate,TopLink,JDO 等 ORM 框架各自为营的局面。 值得注意的是,Jpa是在充分吸收了现有 Hibernate,TopLink,JDO 等 ORM 框架的基础

weixin_52841956的博客 8583

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Spring Boot 整合 Spring Data JPA、strategy 的策略区别、什么是 Spring Data JPA

Spring Boot 整合 Spring Data JPA、strategy 的策略区别、什么是 Spring Data JPA

hutao8896的博客 1113

spring Boot中整合JPA

Spring Boot中的数据持久化方案前面介绍了两种,一个是JdbcTemplate,还有一个MyBatis,JdbcTemplate配置简单,使用也简单,但是功能也非常有限,MyBatis则比较灵活,功能也很强大,公司采用MyBatis做数据持久化的相当多,但是MyBatis并不是唯一的解决方案,除了MyBatis之外,还有另外一个东西,那就是Jpa,下面就来说说Jpa如何实现数据持久化。先简...

zhouym_的博客 666

Spring Boot JPA

/ Spring Boot 3.x 用jakarta.persistence,2.x 用javax.persistence@Entity // 标记为JPA实体@Table(name = "t_user") // 映射的数据库表名@Id // 主键@GeneratedValue(strategy = GenerationType.IDENTITY) // 自增主键。

ZLZQ_Yuan 805

Spring Boot 整合 Spring Data JPA、Spring Boot 整合 Spring Security

Spring Boot 整合 Spring Data JPA Spring Data JPA 是 Spring Data ⼤家族的⼀员 JPA 和 Spring Data JPA 的关系 JPA (Java Persistence API)Java 持久层规范,定义了⼀系列 ORM 接口,它本身是不能直接使用,接口必须实现才能使用,Hibernate 框架就是⼀个实现了 JPA 规范的框架。 Spring Data JPA 是 Spring 框架提供的对 JPA 规范的抽象,通过约定的命名规范完成持久层接口

weixin_44152682的博客 484

Spring Boot 3 【四】Spring Boot 整合JPA

Spring Data JPA 是 Spring Data 项目的一部分,它为使用 Java Persistence API (JPA) 进行数据库访问提供了一种非常简便的方式。Spring Data JPA 的主要目的是简化基于 JPA 的数据访问层的开发工作,开发者可以更加专注于业务逻辑而不是繁琐的数据访问代码。Spring Data JPA 通过提供一套高度抽象的接口和约定,极大地简化了基于 JPA 的数据访问层的开发工作。

技术管理修行 2396
上一篇: Spring boot mybatis
下一篇: Spring-boot-mybatisPlus
xiaoduup
博客等级 码龄9年 23粉丝 83原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值