万本电子书0元读

万本电子书0元读

顶部广告

Spring Data电子书

售       价:¥

14人正在读 | 0人评论 9.8

作       者:Petri Kainulainen

出  版  社:Packt Publishing

出版时间:2012-11-05

字       数:260.7万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
This book is a standard tutorial which provides step-by-step instructions and a lot of code examples that are easy to follow and help you to get started from page one. This book is suited for developers who are working with Spring-powered applications, and are looking for an easier way to write data access code that uses relational databases. Also, if you are interested in learning how you can utilize Redis in your applications, this is the book for you. This book assumes that you have got some experience with the Spring Framework and the Java Persistence API. No previous experience with Redis is required.
目录展开

Spring Data

Table of Contents

Spring Data

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers and more

Why Subscribe?

Free Access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. Getting Started

Java Persistence API

Key concepts

Creating database queries

Native SQL queries

Java Persistence Query Language

The Criteria API

Redis

Supported data types

Persistence

Replication

Publish/subscribe messaging pattern

Summary

2. Getting Started with Spring Data JPA

Downloading dependencies with Maven

Configuring the Spring application context

Creating the properties file

Creating the application context configuration class

Creating the application context configuration skeleton

Configuring the data source bean

Configuring the entity manager factory bean

Configuring the transaction manager bean

Loading the application context configuration

Implementing CRUD functionality for an entity

Domain model

Contact

Creating new contact objects

Updating contact information

Address

Creating new addresses

Updating address information

Creating a custom repository

Creating a custom repository in the old school way

Creating a custom repository with Spring Data JPA

CRUD

Create

Read

Update

Delete

Summary

3. Building Queries with Spring Data JPA

Building queries

Query methods

Query generation from method name

Method prefixes

Property expressions

Keywords

Implementing the search function

Pros and cons

Named queries

Creating a named query

Creating the query method

Creating the service method

Pros and cons

@Query annotation

Creating the query method

Creating the service method

Pros and cons

JPA Criteria API

Adding the JPA Criteria API support to a repository

Creating the criteria query

Creating a static metamodel class

Creating specifications

Creating the service method

Pros and cons

Querydsl

Configuring Querydsl-Maven integration

Configuring Querydsl Maven dependencies

Configuring the code generation Maven plugin

Generating Querydsl query types

Adding Querydsl support to a repository

Creating the executed query

Executing the created query

Pros and cons

What technique should we use?

Sorting query results

Sorting with method name

Creating the query method

Modifying the service method

Sorting with query strings

JPQL queries

SQL queries

Sorting with the Sort class

JpaRepository

Query generation from the method name

@Query annotation

JPA Criteria API

Sorting with Querydsl

What technique should we use?

Paginating query results

Changing the service layer

Creating a class for pagination parameters

Changing the service interface

Creating PageRequest objects

Implementing pagination

JpaRepository

Query generation from the method name

Adding pagination support to the query method

Modifying the service class

Named queries

Adding pagination support to the query method

Modifying the service class

@Query annotation

Adding pagination support to a query method

Modifying the service method

JPA Criteria API

Querydsl

Summary

4. Adding Custom Functionality to JPA Repositories

Adding custom functionality to a single repository

Creating the custom interface

Implementing the created interface

Configuring the repository class

Implementing the custom methods

Creating the repository interface

Creating the service implementation

What did we just do?

Adding custom functionality to all repositories

Creating the base repository interface

Implementing the base repository interface

Creating the repository factory bean

Creating the skeleton of the repository factory bean class

Creating the repository factory inner class

Creating the builder method for the repository factory

Configuring Spring Data JPA

Creating the repository interface

Implementing the service layer

What did we just do?

Summary

5. Getting Started with Spring Data Redis

Installing Redis

Getting the required dependencies

Configuring the Spring application context

Configuring the Redis connection

Configuring the Jedis connector

Configuring the JRedis connector

Configuring the RJC connector

Configuring the SRP connector

Summary

6. Building Applications with Spring Data Redis

Designing a Redis data model

Key components

Atomic counters

RedisTemplate

Operations

Serializers

Implementing a CRUD application

Using default serializers

Configuring the application context

Configuring the Redis template bean

Configuring the Redis atomic long bean

CRUD

Create

Read

Update

Delete

Storing data in JSON

Configuring the application context

Configuring the value serializer bean

Configuring the Redis template bean

Configuring the Redis atomic long bean

CRUD

Create

Read

Update

Delete

The publish/subscribe messaging pattern

Creating message listeners

Implementing the MessageListener interface

Creating a POJO message listener

Configuring the application context

Configuring the message listener beans

Configuring the message listener adapter bean

Configuring the message listener container bean

Sending messages with RedisTemplate

Create

Update

Delete

Verifying the wanted behaviour

Using Spring cache abstraction with Spring Data Redis

Configuring the Spring cache abstraction

Enabling caching annotations

Configuring the host and port of the used Redis instance

Configuring the Redis connection factory bean

Configuring the Redis template bean

Configuring the cache manager bean

Identifying the cached methods

Adding contact information to the cache

Updating the contact information to the cache

Deleting contact information from the cache

Verifying that the Spring cache abstraction is working

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部