This document discusses polyglot persistence using Spring Data. It describes how Spring Data provides a common programming model for data access across different data stores like SQL databases, NoSQL databases and more. It provides examples of defining entities, repository interfaces and queries using Spring Data's JPA, MongoDB and QueryDSL modules. Spring Data aims to improve developer productivity by simplifying data access code and enabling applications to use multiple data sources.
Core Data with multiple managed object contextsMatthew Morey
When using Core Data for persisting app data multiple managed object contexts (MOC) are often required to avoid blocking UI. Typically you would create a background MOC and listen for changes on the main MOC, merging changes as necessary. With iOS 5, MOCs now have parent context and the ability to set concurrency types. These new features greatly simplify dealing with Core Data on background queues. During this presentation Matt will cover the pros and cons of this new method of dealing with Core Data.
Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...DicodingEvent
Dicoding Developer Coaching merupakan webinar, yang membahas tuntas kendala maupun pertanyaan yang sering ditanyakan di Academy Dicoding.
Tema kali ini adalah "Reactive Programming dengan RxJava & Flow"
Reactive Programming adalah pemrograman yang berfokus pada asynchronous data stream. Asynchronous adalah proses di mana kita bisa mengeksekusi suatu perintah secara bersamaan, sedangkan kebalikannya yaitu Synchronous adalah proses eksekusi perintah secara berurutan. Dalam Reactive Programming di Android, terdapat 2 library yang wajib kalian ketahui yaitu ReactiveX dan Coroutine Flow.
http://highperformancecoredata.com/
Learn how to analyze, debug, and squeeze every last bit of performance out of Core Data. The standard Core Data implementation is very powerful and flexible but lacks performance. In this advanced session we will cover various performance analysis tools, model optimization, and various high performance concurrency models. This is an advanced discussion that assumes you have used Core Data before.
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rulesSrijan Technologies
Speaker: Josef Dabernig a.k.a Dasjo
This webinar takes a look at how to automate some powerful backend capabilities for your Drupal site, using the Drupal 8 Rules. Take a look at how D8 Rules can change the way we build sites. Also, learn how you can contribute to getting Rules closer to a stable release.
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017Codemotion
What if someone told you that you could use the full capacity of your server? That you could have the same performance on the backend as your react frontend? Don't you believe it? That you could choose the best language/tool for the task and you were not limited by what you already know? In this talk, I'll show you that you can use the full power of React on the frontend and Vert.x on the backend. You will see a fast full stack development workflow with Rollup/Webpack + Babel + React. How you can mix JavaScript with any other language. Build microservice applications in minutes.
Core Data with multiple managed object contextsMatthew Morey
When using Core Data for persisting app data multiple managed object contexts (MOC) are often required to avoid blocking UI. Typically you would create a background MOC and listen for changes on the main MOC, merging changes as necessary. With iOS 5, MOCs now have parent context and the ability to set concurrency types. These new features greatly simplify dealing with Core Data on background queues. During this presentation Matt will cover the pros and cons of this new method of dealing with Core Data.
Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...DicodingEvent
Dicoding Developer Coaching merupakan webinar, yang membahas tuntas kendala maupun pertanyaan yang sering ditanyakan di Academy Dicoding.
Tema kali ini adalah "Reactive Programming dengan RxJava & Flow"
Reactive Programming adalah pemrograman yang berfokus pada asynchronous data stream. Asynchronous adalah proses di mana kita bisa mengeksekusi suatu perintah secara bersamaan, sedangkan kebalikannya yaitu Synchronous adalah proses eksekusi perintah secara berurutan. Dalam Reactive Programming di Android, terdapat 2 library yang wajib kalian ketahui yaitu ReactiveX dan Coroutine Flow.
http://highperformancecoredata.com/
Learn how to analyze, debug, and squeeze every last bit of performance out of Core Data. The standard Core Data implementation is very powerful and flexible but lacks performance. In this advanced session we will cover various performance analysis tools, model optimization, and various high performance concurrency models. This is an advanced discussion that assumes you have used Core Data before.
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rulesSrijan Technologies
Speaker: Josef Dabernig a.k.a Dasjo
This webinar takes a look at how to automate some powerful backend capabilities for your Drupal site, using the Drupal 8 Rules. Take a look at how D8 Rules can change the way we build sites. Also, learn how you can contribute to getting Rules closer to a stable release.
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017Codemotion
What if someone told you that you could use the full capacity of your server? That you could have the same performance on the backend as your react frontend? Don't you believe it? That you could choose the best language/tool for the task and you were not limited by what you already know? In this talk, I'll show you that you can use the full power of React on the frontend and Vert.x on the backend. You will see a fast full stack development workflow with Rollup/Webpack + Babel + React. How you can mix JavaScript with any other language. Build microservice applications in minutes.
Introduction to React in combination with Redux. Redux helps you to develop applications in a simple way while having features like time-travel available during development.
All Things Open 2014 - Day 2
Thursday, October 23rd, 2014
James Pearce
Head of Open Source with Facebook
Front Dev 1
An Introduction to ReactJS
Find more by James here: https://speakerdeck.com/jamesgpearce
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...Codemotion
We are entering an era where interactions with computers will drastically change. Standard I/O will be replaced by solutions that interact with natural language either spoken or written. The signs of this change are the numerous bots that appear everywhere. The most popular are chatbots. This session focusses on bots, to access them with any client and to create meaningful dialogs respecting the language and emotion of the user.
Dicoding Developer Coaching #27: Android | Membuat Aplikasi Support Online Ma...DicodingEvent
Dicoding Developer Coaching merupakan webinar, yang membahas tuntas kendala maupun pertanyaan yang sering ditanyakan di Academy Dicoding.
Tema kali ini adalah "Membuat Aplikasi Support Online Maupun Offline"
Di sini Anda akan belajar mengenai bagaimana cara membuat aplikasi yang mendukung proses Online maupun Offline. Hal ini memungkinkan aplikasi Anda untuk dapat diakses meskipun tidak terhubung dengan internet, dan juga dapat menghemat bandwith atau sumber daya perangkat Anda karena tidak perlu lagi memuat data terus menerus.
Building React Applications with Redux
with Yuri Takhteyev
OVERVIEW
Since React is just a “view framework”, it leaves you with lots of options for how to architect the deeper parts of your stack. The best way to handle those deeper layers is by using Redux – a state container that allows you to write much of your application in the form of pure functions. Using Redux helps you write applications that are much easier to test and understand and to achieve more thorough separation between your views and your business logic. Redux also unlocks the possibility of using amazing tools.
OBJECTIVE
Introduce the audience to Redux, a state container that can be used together with React to achieve sanity deeper down in your stack.
TARGET AUDIENCE
Developers familiar with core React and looking for a better way to architect their applications.
ASSUMED AUDIENCE KNOWLEDGE
Core React knowledge is assumed. Familiarity with basic Flux concepts would help, but I’ll review those quickly.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
Why pure functions make your code easier to maintain.
How unidirectional data flows help you sleep better at night.
How Redux helps you manage state better via reducers.
How to use Redux together with React.
How to test Redux applications.
Introduction to React in combination with Redux. Redux helps you to develop applications in a simple way while having features like time-travel available during development.
All Things Open 2014 - Day 2
Thursday, October 23rd, 2014
James Pearce
Head of Open Source with Facebook
Front Dev 1
An Introduction to ReactJS
Find more by James here: https://speakerdeck.com/jamesgpearce
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...Codemotion
We are entering an era where interactions with computers will drastically change. Standard I/O will be replaced by solutions that interact with natural language either spoken or written. The signs of this change are the numerous bots that appear everywhere. The most popular are chatbots. This session focusses on bots, to access them with any client and to create meaningful dialogs respecting the language and emotion of the user.
Dicoding Developer Coaching #27: Android | Membuat Aplikasi Support Online Ma...DicodingEvent
Dicoding Developer Coaching merupakan webinar, yang membahas tuntas kendala maupun pertanyaan yang sering ditanyakan di Academy Dicoding.
Tema kali ini adalah "Membuat Aplikasi Support Online Maupun Offline"
Di sini Anda akan belajar mengenai bagaimana cara membuat aplikasi yang mendukung proses Online maupun Offline. Hal ini memungkinkan aplikasi Anda untuk dapat diakses meskipun tidak terhubung dengan internet, dan juga dapat menghemat bandwith atau sumber daya perangkat Anda karena tidak perlu lagi memuat data terus menerus.
Building React Applications with Redux
with Yuri Takhteyev
OVERVIEW
Since React is just a “view framework”, it leaves you with lots of options for how to architect the deeper parts of your stack. The best way to handle those deeper layers is by using Redux – a state container that allows you to write much of your application in the form of pure functions. Using Redux helps you write applications that are much easier to test and understand and to achieve more thorough separation between your views and your business logic. Redux also unlocks the possibility of using amazing tools.
OBJECTIVE
Introduce the audience to Redux, a state container that can be used together with React to achieve sanity deeper down in your stack.
TARGET AUDIENCE
Developers familiar with core React and looking for a better way to architect their applications.
ASSUMED AUDIENCE KNOWLEDGE
Core React knowledge is assumed. Familiarity with basic Flux concepts would help, but I’ll review those quickly.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
Why pure functions make your code easier to maintain.
How unidirectional data flows help you sleep better at night.
How Redux helps you manage state better via reducers.
How to use Redux together with React.
How to test Redux applications.
Java and Spring Data JPA: Easy SQL Data Access
Abstract
Presenter: Miya W. Longwe, MBA, MSE, Tech Lead, Staples, Inc, Framingham MA 01702
Accessing data repositories in various applications programming languages typically involves writing of tedious boilerplate lines of code. Some application development frameworks such as Spring have tried to make the experience more succinct by providing abstraction layers such as HibernateTemplate and JdbcTemplate, etc. Despite these APIs, the developers still spend a lot time writing repetitive code than concentrating on implementing business requirements. Developers at Spring, led by Oliver Gierke, introduced Spring Data JPA which “aims to significantly improve the implementation of data access layers by reducing the effort to the amount that's actually needed. As a developer you write your repository interfaces, including custom finder methods, and Spring will provide the implementation automatically”.
Spring Data JPA provides a powerful, out-of-the-box alternative to creating your own DAO framework. You declare custom repository operations on an interface, and the framework generates dynamic implementations (not code generation) automatically, based on conventions around method names. As part of the presentation, we'll also review a demo to look at Spring Java configuration (as opposed to XML configuration), and investigate the @Profile annotation – configuration details which may make life a bit easier in various ways when setting up unit testing of our repository classes, using out-of-the-box alternative to creating DAO framework, how to create custom repositories, pagination and support for custom queries among other features.
Presenter's Bio
Miya W. Longwe is a Senior Software Engineer and Tech Lead at Staples, Inc. where he is currently working on an initiative to re-platform the company’s ecommerce architecture to offer platform-driven, modular products that can be quickly customized, enhanced, and branded as needed.
Miya has been a software professional since 1997. His 16 years software development career includes working for large companies to small startups, building solutions for enterprises and consumers, working with a broad range of technologies.
Miya Longwe is a hands-on java developer. He believes that in order to be a relevant and effective software developer one needs to remain a deeply knowledgeable, up-to-date, and productive software developer. His research interests include model-driven engineering, domain specific languages, test driven development and project risk management.
Miya graduated from the University of Malawi (Lilongwe, Malawi) and has an MBA from the University of Wales Cardiff Business School (Wales, UK) and a Masters in Software Engineering from Brandeis University (MA, USA).
Occasionally, Miya can be spotted fishing the banks of the south shore (MA) with his two boys, William and Daniel.
This session will provide attendees with hands-on experience and in-depth knowledge of using Node.js as a runtime environment and Express.js as a web framework to build scalable and fast backend systems. Additionally, attendees will learn about Passport.js, a popular authentication middleware for Node.js, and how to use Prisma ORM to handle database operations in a type-safe and efficient manner.
The session will be conducted by experienced developers who have worked with these technologies and will be able to provide valuable insights and best practices. The session will be interactive and include plenty of opportunities for attendees to ask questions and work on real-world projects.
Webinar: Building Your First App with MongoDB and JavaMongoDB
This webinar will walk you through building a simple Java-based application in MongoDB. We’ll cover the basics of MongoDB’s document model, query language, aggregation framework, and deployment architecture.
In this webinar, you will discover:
- How easy it is to start building Java applications with MongoDB
- Key features for manipulating and accessing data
- High availability and scale-out architecture
- WriteConcerns and ReadPreference
SQLAdria 2009 presentation's slides about our experience with Maven and SQLJ. It delves in some details about SQLJ and performance comparion between SQLJ and JDBC with prepared statements. It also shows surprising results for what concerns performances of (DB2) SQL PL procedures
This presentation was given by course moderator Phill Jones of MoreBrains Cooperative during the initial session of the NISO Spring training series "Working with Scholarly APIs." Session One, Foundational Specifics, was held on April 28, 2022.
Gradle is the build system you have been waiting for or maybe the build system that has been waiting for you. The adoption rate is incredible from being the new Google Android development tools build system to most new Java opensource projects to JavaScript based front-end and back-end projects.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
3. Definitions
● Persistence
● the action or fact of persisting
● the quality or state of being persistent; especially :
perseverance
● the quality that allows someone to continue doing
something or trying to do something even though it is
difficult or opposed by other people
● the state of occurring or existing beyond the usual,
expected, or normal time
4. Definitions
● Polyglot
● knowing or using several languages
● computer program or script written in a valid form of
multiple programming languages
5. Polyglot – Sample
#define a /*
#<?php
echo "010Hello, world!n";// 2> /dev/null > /dev/null ;
// 2> /dev/null; x=a;
$x=5; // 2> /dev/null ;
if (($x))
// 2> /dev/null; then
return 0;
// 2> /dev/null; fi
#define e ?>
#define b */
#include <stdio.h>
#define main() int main(void)
#define printf printf(
#define true )
#define function
function main()
{
printf "Hello, world!n"true/* 2> /dev/null | grep -v true*/;
return 0;
}
#define c /*
main
#*/
6. What is going on in persistence?
● RDBMS doesn't scale to Internet (millions of users and billions of transactions).
● Ability to interact with multiple data stores depending on specific use cases
● MongoDB or Couchbase for Customer data
● RDBMS for financial transactions
● Elasticsearch, Solr, Cassandra or HBase for audit trails and analytics and
search
● Redis and Gemfire for shared state
● Neo4J, OrientDB for Graph Data
● RDF Stores for Semantic Reasoning
● Hadoop for Big Data
7. Simple JDBC Example
import java.sql.*;
public class SimpleDemoJDBC {
public Person getPerson(String userId, Connection conn) throws SQLException {
Person result = null;
PreparedStatement pstmt = conn.prepareStatement(
"SELECT userId, email, name FROM persons WHERE userId = ?");
pstmt.setString(1, userId);
ResultSet rs = pstmt.executeQuery();
if(rs.next()) {
result = new Person(rs.getString(1), rs.getString(2), rs.getString(3));
}
rs.close();
pstmt.close();
return result;
}
public void updatePerson(Person person, Connection conn) throws SQLException {
Statement stmt = conn.prepareStatement(
"UPDATE persons SET email = ?, name = ? WHERE userId = ?");
stmt.setString(1, person.getEmail());
stmt.setString(2, person.getName());
stmt.setString(3, person.getUserId());
stmt.executeUpdate();
stmt.close();
}
}
8. SQLJ what happened there?
import java.sql.*;
public class SimpleDemoSQLJ {
public Person getPerson(String userId) throws SQLException {
Person person = new Person();
#sql { SELECT userId, email, name INTO
:person.userId, :person.email, :person.userId
FROM persons WHERE userId = :userId
};
return person;
}
public void updatePerson(Person person) throws SQLException {
#sql { UPDATE persons SET email = :person.email,
name = :person.name
WHERE userId = :person.userId
};
}
}
Syntax may be incorrect
9. MongoDB Sample
DB db = mongo.getDB("MyData");
DBCollection persons = db.getCollection("Persons");
public Person findPerson(String userId) {
Iterable<Document> documents = persons.find(
new Document("userId", userId));
for(Document doc : documents) {
return new Person(doc.get("userId", String.class),
doc.get("name", String.class),
doc.get("email", String.class));
}
return null;
}
public void updatePerson(Person person) {
Document doc = new Document(“userId”, person.getUserId());
doc.put(“email”, person.getEmail());
doc.put(“name”, person.getName());
Document query = new Document("userId", person.getUserId());
Document update = new Document(“$set”, doc);
persons.update(query, update);
}
10. What are we talking about?
● Improve programmer productivity.
● Polyglot persistence using one language.
● The language of Spring Data.
11. Spring for programmer productivity
● Spring does not provide ORM
● Spring does not provide Database
● Spring as inversion of control container
● Spring templates for JMS, JDBC, Hibernate, JPA,
MongoDB and much more.
12. Why Spring Data?
● Best practice indicates you should have Data Access
Components or a Data Service Layer.
● How often do you make simple mistakes interacting with
EntityManager?
● Different API for each store.
● It should be easier...
13. What is Spring Data?
● Spring Data is an open source project at
http://projects.spring.io/spring-data/ managed by Pivotal Software.
● Spring Data relies on Spring Framework.
● Spring Data provides a set of common patterns for persisting data
using existing libraries.
● Spring Data provides a Repository Interface
● Spring Data provides finder methods
● Spring Data provides support for QueryDSL
● Spring Data simplifies persistence
● Spring Data enables polyglot persistence
15. How Spring Data?
● Configure Spring Data for specific technology
● Define Entity as per relevant library or framework
● Declare Repository Interface
● Spring Data provides Repository Implementation
● Spring Framework injects Repository implementation
16. Spring Data Samples – Configuration
● EntityManagerFactory as normal for JPA
<jpa:repositories
base-package="com.springframework.data.demo" />
OR
@EnableJpaRepositories({"com.springframework.data.demo"})
17. Spring Data Sample – Entity
@Entity
public class User {
@Id
Long id;
String fullName;
String gender;
Date dateOfBirth;
}
Getters and Setters removed for brevity
18. Spring Data Sample – Repository
public interface UserRepository
extends CrudRepository<User, Long> {
}
● Crud Repository provides type-safe methods for save,
delete, load
19. Spring Data Sample - Injection
@Service
public class MyDataServiceImpl {
@AutoWired
protected UserRepository userRepo;
public void createUser(User user) {
userRepo.save(user);
}
}
20. Spring Data Sample – Finders
public interface UserRepository
extends CrudRepository<User, Long> {
List<User> findByGender(String genderCode);
List<User> findByDateOfBirthBetween(
Date startDate, Date endDate);
}
● Crud Repository provides query predicates based on method name like:
findByNameOrderByDateOfBirthDesc
findByNameAndGender
● Finder method tokens
● And, Or, Is, Equals, Between, LessThan, LessThanEqual, GreaterThan,
GreaterThanEqual, After, Before, IsNull, IsNotNull, NotNull, Like,
NotLike, StartingWith, EndingWith, Containing, Not, In, NotIn, True,
False, IgnoreCase
21. Spring Data Query
● Specific to technology
● Annotated finder method
@Query("select * from User u where u.gender = ?")
List<User> findUsersForGender(String code)
Getters and Setters removed for brevity
22. Spring Data Sample – QueryDSL
@Entity
@QueryEntity
public class User {
@Id
private Long id;
private String fullName;
private String gender;
private Date dateOfBirth;
}
● QueryDSL generates QUser for creating type-safe query.
class UserRepository extends
QueryDslPredicateExecutor<User>,
CrudRepository<User,Long> {
}
import static Quser.*;
List<User> users = userRepo.findAll(user.gender.eq('M'));
List<User> users = userRepo.findAll(user.fullName.like("%abc%"));
23. Spring Data – Paging and Sorting
class UserRepository extends
PagingAndSortingRepository<User, Long> {
}
...
Pageble page = new PageRequest(1,20);
Page<User> users = userRepo.findAll(user.gender.eq("M"), page);
● Create Pageable in UI and add to method.
● Add Pageble to finders
● Add Sort to finders
● Page<User> can be used to retrieve pages.
● Slice<User> can only retrieve next slice.
24. Spring Data – Notes
● Shared code for multiple technologies like MongoDB,
JPA, Neo4J etc.
● Entity Mapping is usually specific to technology.
● Common Repository methods can be implemented.
● Paging and Sorting support.
25. Spring Data – Demo and
Questions
● JPA With Hibernate
● MongoDB
● QueryDSL
● Demo code at
https://github.com/corneil/spring-data-demo