Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Spring Data

You're reading from   Spring Data Want to make it easier to implement data access with your Spring-powered applications? Then this is the book you need. A complete tutorial to Spring Data, it makes learning easier with lots of code examples and clear instructions.

Arrow left icon
Product type Paperback
Published in Nov 2012
Publisher Packt
ISBN-13 9781849519045
Length 160 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Petri Kainulainen Petri Kainulainen
Author Profile Icon Petri Kainulainen
Petri Kainulainen
Arrow right icon
View More author details
Toc

Implementing CRUD functionality for an entity


We have now configured the Spring application context and configured our web application to load it during startup. We will now implement CRUD functions for a simple entity. Our example application is used to view and manage contact information, and we can implement it by following these steps:

  1. Create a domain model.

  2. Create a repository for an entity.

  3. Implement CRUD functions.

Note

This chapter describes only such parts of our application that are required to understand how Spring Data JPA works.

Domain model

The domain model of our application consists of two classes: Contact and Address. This subsection will address the following matters:

  • The information content of each class

  • How we can create new objects by using the builder pattern (see also: Effective Java (Second Edition), Joshua Bloch, Addison-Wesley)

  • How we can update the information of an object

Contact

The Contact class is the only entity of our domain model and it contains the information of a...

You have been reading a chapter from
Spring Data
Published in: Nov 2012
Publisher: Packt
ISBN-13: 9781849519045
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image