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(?)

  • 相关阅读:
    XML实例入门2
    XML入门
    XML实例入门1
    C语言复合梯形公式实现定积分
    一些界面库比较以及如何选择界面库
    网络阅读开篇
    vs2008 edit spin 十六进制实现
    jquery操作cookie
    Excel导入到DataTable
    SQL 查找某个字段的首字母
  • 原文地址:https://www.cnblogs.com/yangjiming/p/9618113.html
Copyright © 2011-2022 走看看