Spring Data JPA Tutorial Series (i)--------Getting Started _spring

Source: Internet
Author: User

Big slag Good, I am a little scholar, now begin, we come to learn the ship new technology, SPRINGDATAJPA, it is a. Amount of ... (I Baidu)

The JPA (Java Persistence API) is an official Java persistence specification by Sun. It provides Java developers with an object/association mapping tool to manage relational data in Java applications. His appearance is mainly to simplify the existing persistent development work and integrate ORM technology, to end the current HIBERNATE,TOPLINK,JDO and other ORM framework for their respective camps. It is noteworthy that JPA is developed on the basis of fully absorbing ORM frameworks such as existing hibernate,toplink,jdo, and has the advantages of ease of use and strong scalability. In response to the current development community, JPA has been greatly supported and praised, including the development team of spring and EJB3.0.

Note: JPA is a set of specifications, not a set of products, so like hibernate,toplink,jdo they are a set of products, if these products implement this JPA specification, then we can call them for the JPA implementation 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 with minimalist code. It provides common functions including additions and deletions, and is easy to expand. Learning and using Spring Data JPA can greatly improve development efficiency.

Spring data JPA frees us from the DAO layer, and basically all crud can depend on it to implement

Okay, here's the introduction to Spring Data JPA, now just go

-------Simple Query

The unique thing about Spring Data JPA is that simple queries don't have to write implementation classes at all, just write interfaces directly, and they can generate SQL based on your interface, cool.

The rules are resolved according to the method name:

find+ Global Decoration +by+ Entity property name + qualifier + connector + (other entity property) +orderby+ Sort attribute + sort direction

For example:

Finddistinctbyfirstnameignorecaseandlastnameorderbyagedesc (String firstname,string lastName)

(Wow, that's a long way.) Good magic)

Global modifier: Distinct,top,first

Keywords (qualifier + connectives): Isnull,isnotnull,like,notlike,containing,in,notin,ignorecase,between,equals,

Lessthan,greaterthan,after,before

Sort direction: Asc,desc

Nested entity method naming rules:

For example:

List<person> Findbyaddress_zipcode (ZipCode ZipCode)

Word-formation: the child entity name in the primary entity +_+ the child entity attribute name


The keywords are constructed by using the following methods:

Corresponds to SQL:  select * from user where phone like ' 136% ' and ' '% '% '
Findbyphonestartingwithandadresscontai Ning (String phone, string address);

All supported Keywords:




This class will be here, class ...


Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.