zoukankan      html  css  js  c++  java
  • spring-data

    1. spring-data是spring提供的数据访问层框架,封装若干种数据服务访问能力。

      spring-data-jpa:通过JPA标准规范,底层使用Hibernate框架实现。
      spring-data-jdbc:就是底层使用spring-jdbc实现,可以使用Mybatis技术作为底层实现的替代产品。
      spring-data-redis:底层使用jedis实现。 
    2. spring-data-JPA

      1. 类图
      2. Repository标记接口。可以继承此接口,根据指定的规则,实现数据查询。只能做单表查询,且查询结果一定是实体类型对象或实体类型对象的集合。命名规则:findBy(关键字)+属性名称(属性名称的首字母大写)+查询条件(首字母大写)

        关键字

        方法命名

        sql where字句

        And

        findByNameAndPwd

        where name= ? and pwd =?

        Or

        findByNameOrSex

        where name= ? or sex=?

        Is,Equal

        findById,findByIdEquals

        where id= ?

        Between

        findByIdBetween

        where id between ? and ?

        LessThan

        findByIdLessThan

        where id < ?

        LessThanEqual

        findByIdLessThanEquals

        where id <= ?

        GreaterThan

        findByIdGreaterThan

        where id > ?

        GreaterThanEqual

        findByIdGreaterThanEquals

        where id > = ?

        After

        findByIdAfter

        where id > ?

        Before

        findByIdBefore

        where id < ?

        IsNull

        findByNameIsNull

        where name is null

        isNotNull,NotNull

        findByNameNotNull

        where name is not null

        Like

        findByNameLike

        where name like ?

        NotLike

        findByNameNotLike

        where name not like ?

        StartingWith

        findByNameStartingWith

        where name like '?%'

        EndingWith

        findByNameEndingWith

        where name like '%?'

        Containing

        findByNameContaining

        where name like '%?%'

        OrderBy

        findByIdOrderByXDesc

        where id=? order by x desc

        Not

        findByNameNot

        where name <> ?

        In

        findByIdIn(Collection<?> c)

        where id in (?)

        NotIn

        findByIdNotIn(Collection<?> c)

        where id not  in (?)

        True

        findByAaaTue

        where aaa = true

        False

        findByAaaFalse

        where aaa = false

        IgnoreCase

        findByNameIgnoreCase

        where UPPER(name)=UPPER(?)

  • 相关阅读:
    JavaScript作用域学习笔记
    Object.prototype.toString.call() 区分对象类型
    oracle 经典SQL整理
    day31
    ID3决策树
    C# 中浅拷贝与深拷贝区别
    C#值类型和引用类型的区别
    C#守护进程(windows服务)
    C#线程池
    C#双缓冲绘图
  • 原文地址:https://www.cnblogs.com/yangjiming/p/9618113.html
Copyright © 2011-2022 走看看