SpringCloud使用jpa之Rest方式
这个与上一篇的基本相同,需要修改的只有Dao层的文件:
TablesDao.java
package com.shinho.dao; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource; import com.shinho.entity.Tables; @RepositoryRestResource(collectionResourceRel = "people", path = "people")
public interface TablesDao extends CrudRepository<Tables, Integer> { @Query(value="select count(*) from props",nativeQuery=true)
int getcount();
}
这里有个学问,就是访问的地址,是这样一个规则,比如现在看到的这个getcount的方法:
http://localhost:7088/people/search/getcount
蛋疼!
还有,这个东西是Spring Data JPA,一定要看官网,不要看网上的野文!
官网地址:http://projects.spring.io/spring-data-jpa/
SpringCloud使用jpa之Rest方式的更多相关文章
- SpringCloud使用jpa之传统方式
不说废话,直接上代码: pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xml ...
- 【hibernate/JPA】注解方式实现 复合主键【spring boot】
1>hibernate/JPA实现复合主键的思路:是将所有的主键属性封装在一个主键类中,提供给需要复合主键的实体类使用. 2>主键类的几点要求: . 使用复合主键的实体类必须实现Seria ...
- 数据库链接 mybatis spring data jpa 两种方式
jdbc mybatis spring data jpa dao service webservice jaxrs jaxws springmvc w ...
- springcloud +spring security多种验证方式之第三方token生成自己的token通过校验和自己的表单验证大体流程
步骤: 1.继承 WebSecurityConfigurerAdapter.class,其中使用两个过滤器,一个spring scurity自带的UsernamePasswordAuthenticat ...
- JPA,EclipseLink 缓存机制学习(一) 树节点搜索问题引发的思考
最近在项目在使用JPA+EclipseLink 的方式进行开发,其中EclipseLink使用版本为2.5.1.遇到一些缓存方面使用不当造成的问题,从本篇开始逐步学习EclipseLink的缓存机制. ...
- JPA学习笔记1——JPA基础
1.JPA简介: Java持久化规范,是从EJB2.x以前的实体Bean(Entity bean)分离出来的,EJB3以后不再有实体bean,而是将实体bean放到JPA中实现.JPA是sun提出的一 ...
- 大话JPA
JPA 是什么 Java Persistence API:用于对象持久化的 API Java EE 5.0 平台标准的 ORM 规范,使得应用程序以统一的方式访问持久层: 首先看一下传统方式访问数据库 ...
- 二、spring Boot构建的Web应用中,基于MySQL数据库的几种数据库连接方式进行介绍
包括JDBC.JPA.MyBatis.多数据源和事务. 一.JDBC 连接数据库 1.属性配置文件(application.properties) spring.datasource.url=jdbc ...
- springcloud情操陶冶-springcloud config server(一)
承接前文springcloud情操陶冶-springcloud context(二),本文将在前文基础上浅析下ConfigServer的工作原理 前话 根据前文得知,bootstrapContext引 ...
随机推荐
- python笔记05:条件、循环和其它语句
5.1 print和import的更多使用方式 5.1.1 使用逗号输出 print 'Age',42 print 1,2,3 如果要同时输出文本和变量值,又不希望使用字符串格式化的话,那么这个特性就 ...
- 内核事件KEVENT(同步)
转载请您注明出处:http://www.cnblogs.com/lsh123/p/7358702.html 一.驱动程序与驱动程序的事件交互 IoCreateNotificationEvent ...
- kbmMW 5.06.20试用笔记
1.kbmMWConfiguration自动备份配置文件的问题还没有修正. 下面是以前写过的内容,再一次在新闻组中提出这个问题: kbmMW提供一个强大的配置信息管理对象,前期译过这个对象的介绍,在使 ...
- block ,GCD(转)
原文:http://blog.sina.com.cn/s/blog_45e2b66c01010dhd.html 1.GCD之dispatch queue http://www.cnblogs.com/ ...
- git stash,git cherry-pick
git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致.同时,将当前的工作区内容保存到Git栈中.git stash pop: 从Git栈中读取 ...
- HDU 1518 Square(DFS)
Problem Description Given a set of sticks of various lengths, is it possible to join them end-to-end ...
- Spring AOP体系学习总结
要理解AOP整体的逻辑需要理解一下Advice,Pointcut,Advisor的概念以及他们的关系. Advice是为Spring Bean提供增强逻辑的接口,提供了多种方法增强的方式,比如前置, ...
- 【opencv基础】pointPolygonTest
pointPolygonTest opencv函数 pointPolygonTest: C++: double pointPolygonTest(InputArray contour, Point2f ...
- TJU Problem 2857 Digit Sorting
原题: 2857. Digit Sorting Time Limit: 1.0 Seconds Memory Limit: 65536KTotal Runs: 3234 Accepted ...
- 数组Arry的随机排序
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...