This is your own reference to the Springside Open source Project Integration Framework, the main integration of spring, Spring MVC, Spring data JPA, hibernate these frameworks, for these frameworks it feels more comfortable or spring
{
@Autowired
private UserRepository userRepository;
@RequestMapping("/")
public ModelAndView index() {
userRepository.save(new User("老王",18,"123456"));
ModelAndView modelAndView = new ModelAndView("/index");
modelAndView.addObject("dataSize", userRepository.findAll().size());
return modelAndView;
}
}
So far, the integrated Spring Data
left the operation of the domain object code, transaction management and Entitymanager creation, The destruction of the code no longer requires the developer's concern.
Spring Data JPA is more concise The spring data JPA fra
example, some interfaces you only want to provide an increased operation and do not want to provide a method of deletion. In this case, developers can only go back to the Repository interface and then copy the method declaration that they want to keep to the custom interface in Crudrepository.3. Paging queries and sorting are common features of the persistence layer, and Spring
need to be preceded or followed by "%", for example: @Query ("Select O from the Usermodel o where O.name like?" 1% ") public listNote:The current version of the local query does not support page flipping and dynamic sorting using the named parameters, using @param, such as: @Query (value= "Select O from Usermodel o where o.name like%:nn") public list Lt Usermodel> Findbyuuidorage (@Param ("nn") String name), as well as support for updating the Query
The configuration of the data source can be followed by the example of Spring boot Learning (vii) Web applications using the Datasourceconfig implementation of JdbcTemplate multiple data source configuration. Add the JPA configuration for the first
This is your own reference Springside Integration Framework for open source projects. The main integration of spring, Spring MVC, Spring data JPA, hibernate several frameworks, still feel more comfortable in these frameworks spring
Recently work too busy, so delay to everyone to share the actual combat springboot framework of use.The following is the use of spring boot to integrate multiple frameworks.The first is to prepare for the job well.First, the package required to import the framework, we use the thing Maven to manage the package.The above example is my h5ds real background management project. The project is being financed wit
1.JPAJPA (Java Persistence API) is the Java Persistence specification proposed by Sun. It provides Java developers with an object/association mapping tool to manage relational data in Java applications. The main purpose of his presence is to simplify existing persistent development efforts and integrate ORM technology, and to end the current Hibernate,toplink,jdo and other ORM frameworks for each battalion. It is worth noting that
various types of simple additions and deletions, spring data provides a direct query based on the proxy method, nothing needs to do, the only need to write interfaces, naming methods, this part is too convenient, and simple query to solve almost 80% of the problem. This part is relatively simple, do not repeat, refer to the use of the Daquan section.
Because of the implementation of the template DAO, so th
databasesBecause of the distributed development pattern used in daily projects, different services have different data sources, often need to use multiple data sources in one project, so it is necessary to configure the use of sping data JPA for multiple data sources, which
"Spring Data JPA Development Manual--1. Introduction"Chszs, reprint need to indicate. Blog home:Http://blog.csdn.net/chszsI find that there are few articles on the web that tell the principles of spring data JPA, many of which are
Recently, team started to try Spring Boot + Spring data JPA as a solution to the data tier, and after a few laps on the internet, it was found that everyone was not in the JPA, for (1) MyBatis simple and intuitive enough, (2) The
Spring Data JPA Introduction First understand what JPA is?JPA (Java Persistence API) is the Java Persistence specification proposed by Sun . It provides Java developers with an object/association mapping tool to manage relational data
product
Spring Data JPA is a set of JPA application frameworks encapsulated by spring based on the ORM framework, JPA specification, which enables developers to access and manipulate data
;
} public void Setisldap (Integer isldap) {this.isldap = Isldap;
} public Integer GetId () {return id;
} public void SetId (Integer id) {this.id = ID; }
}
2.5 Writing the DAO layer of Spring data JPA (play OH)
First, let's look at the naming conventions of spring dat
Spring Data JPA development manual-1. IntroductionSpring Data JPA development manual-1. introduction I found that there were almost no articles on the Internet about the principles of Spring D
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.