Spring Data Requery is alternatives of Spring Data JPA
Requery is lightweight ORM for DBMS (MySQL, PostgreSQL, H2, SQLite, Oracle, SQL Server)
Spring Data Requery provide Query By Native Query, Query By Example and Query By Property like Spring Data JPA
Spring Data Requery is better performance than JPA
Spring Day | Spring and Scala | Eberhard WolffJAX London
2011-10-31 | 09:45 AM - 10:30 AM
Spring is widely used in the Java world - but does it make any sense to combine it with Scala? This talk gives an answer and shows how and why Spring is useful in the Scala world. All areas of Spring such as Dependency Injection, Aspect-Oriented Programming and the Portable Service Abstraction as well as Spring MVC are covered.
Production debugging is hard, and it’s getting harder. With architectures becoming more distributed and code more asynchronous and reactive, pinpointing and resolving errors that happen in production is no child’s game. This session covers some essential tools and more advanced techniques Scala developers can use to debug live applications and resolve errors quickly. It explores crucial techniques for distributed debugging - and some of the pitfalls that make resolution much harder, and can lead to downtime. The talk also touches on some little-known JVM tools and capabilities that give you super-deep visibility at high scale without making you restart it or attach debuggers.
Spring Data Requery is alternatives of Spring Data JPA
Requery is lightweight ORM for DBMS (MySQL, PostgreSQL, H2, SQLite, Oracle, SQL Server)
Spring Data Requery provide Query By Native Query, Query By Example and Query By Property like Spring Data JPA
Spring Data Requery is better performance than JPA
Spring Day | Spring and Scala | Eberhard WolffJAX London
2011-10-31 | 09:45 AM - 10:30 AM
Spring is widely used in the Java world - but does it make any sense to combine it with Scala? This talk gives an answer and shows how and why Spring is useful in the Scala world. All areas of Spring such as Dependency Injection, Aspect-Oriented Programming and the Portable Service Abstraction as well as Spring MVC are covered.
Production debugging is hard, and it’s getting harder. With architectures becoming more distributed and code more asynchronous and reactive, pinpointing and resolving errors that happen in production is no child’s game. This session covers some essential tools and more advanced techniques Scala developers can use to debug live applications and resolve errors quickly. It explores crucial techniques for distributed debugging - and some of the pitfalls that make resolution much harder, and can lead to downtime. The talk also touches on some little-known JVM tools and capabilities that give you super-deep visibility at high scale without making you restart it or attach debuggers.
Since its first public release over two decades ago, the Java platform has become ubiquitous in virtually all areas of computing; from embedded systems to enterprise applications. As the demands of modern software development have evolved, so too have programming languages. There are many languages on the Java platform designed to be a “better Java”; though none are as widespread as Java itself. Despite the somewhat conservative nature of Java as a language, there have been a number of notable additions designed to address the challenges developers face without breaking compatibility. This presentation aims to provide an overview of the newer language features and APIs in recent releases of Java in the hope of increasing developer productivity.
Hibernate 3: Hibernate-What it is ?, ORM and Issues, Hibernate Hello World CRUD, Hello world with Servlet, Hibernate Object life cycle, Hibernate Architecture, Object as Component mapping, Hibernate Inheritance, Hibernate Unidirectional Mapping, Hibernate Bidirectional mapping, HQL, Native SQL queries, Named Quarries
Hibernate inheritance and relational mappings with examplesEr. Gaurav Kumar
Topics included in presentation:
1. Hibernate mappings.
2. Type of mappings(Bidirectional and Unidirectional)
a. One to Many
b. One to one
c. Many to many
3. Inheritance in Hibernate
a. table per class hierarchy
b. table per subclass
c. table per concrete class
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...Sagar Verma
16. Threads in Java
Non-Threaded Applications
Threaded Applications
Process based multitasking Vs Thread based multitasking
Thread API in Java
Creating Threads
States of a Thread
Synchronization for threads; static and non-static synchronized methods; blocks; concept of object and class locks
Coordination between threads - wait, notify and notifyAll methods for inter-thread communication
17. Applets
What are applets?
Need for Applets
Different ways of running an applet program
Applet API hierarchy
Life Cycle of an applet
Even Handlers for applets, mouse events, click events
18. Swing GUI
Introduction to AWT
Introduction to Swing GUI
Advantages of Swing over AWT
Swing API
Swing GUI Components
Event Handlers for Swing
Sample Calculator application using Swing GUI and Swing Event handling
19. JDBC
What is JDBC; introduction
JDBC features
JDBC Drivers
Setting up a database and creating a schema
Writing JDBC code to connect to DB
CRUD Operations with JDBC
Statement types in JDBC
Types of Rowset, ResultSet in JDBC
20. Access Modifiers in Java
What are access modifiers?
Default
Protected
Private
Public
A powerful ORM tool to design data base access layer.
Fills gaps of mismatches between OOPs and RDBMS paradigm. Also maintains adequate ultra performance of database access.
An automated, configurable persistence of java objects with tables in data base.
May not be a good solution for data-centric application which uses only stored procedures to implement business logic in the database.
Introduction to JPA and Hibernate including examplesecosio GmbH
In this talk, held as part of the Web Engineering lecture series at Vienna University of Technology, we introduce the main concepts of Java Persistence API (JPA) and Hibernate.
The first part of the presentation introduces the main principles of JDBC and outlines the major drawbacks of JDBC-based implementations. We then further outline the fundamental principles behind the concept of object relation mapping (ORM) and finally introduce JPA and Hibernate.
The lecture is accompanied by practical examples, which are available on GitHub.
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Sagar Verma
Collection Framework in Java,Generics,Input-Output in Java,Serialization,Inner Classes
Collection Framework in Java
The Collections Framework - Set Interface- List Interface - Map Interface - Queue Interface -Sorting collections using utility methods
equals () and hash Code contract in Java collections
Overriding equals and hash Code methods in Java
Generics
Generics for Collections, class and methods
Input-Output in Java
What is a stream? ,Bytes vs. Characters, Java IO API ,Reading a file; writing to a file using various APIs
Reading User input from console , PrintWriter Class
Serialization
Object Serialization , Serializable Interface , De-Serializable
Inner Classes
Inner Classes ,Member Classes, Local Classes, Anonymous Classes, Static Nested Classes
Since its first public release over two decades ago, the Java platform has become ubiquitous in virtually all areas of computing; from embedded systems to enterprise applications. As the demands of modern software development have evolved, so too have programming languages. There are many languages on the Java platform designed to be a “better Java”; though none are as widespread as Java itself. Despite the somewhat conservative nature of Java as a language, there have been a number of notable additions designed to address the challenges developers face without breaking compatibility. This presentation aims to provide an overview of the newer language features and APIs in recent releases of Java in the hope of increasing developer productivity.
Hibernate 3: Hibernate-What it is ?, ORM and Issues, Hibernate Hello World CRUD, Hello world with Servlet, Hibernate Object life cycle, Hibernate Architecture, Object as Component mapping, Hibernate Inheritance, Hibernate Unidirectional Mapping, Hibernate Bidirectional mapping, HQL, Native SQL queries, Named Quarries
Hibernate inheritance and relational mappings with examplesEr. Gaurav Kumar
Topics included in presentation:
1. Hibernate mappings.
2. Type of mappings(Bidirectional and Unidirectional)
a. One to Many
b. One to one
c. Many to many
3. Inheritance in Hibernate
a. table per class hierarchy
b. table per subclass
c. table per concrete class
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...Sagar Verma
16. Threads in Java
Non-Threaded Applications
Threaded Applications
Process based multitasking Vs Thread based multitasking
Thread API in Java
Creating Threads
States of a Thread
Synchronization for threads; static and non-static synchronized methods; blocks; concept of object and class locks
Coordination between threads - wait, notify and notifyAll methods for inter-thread communication
17. Applets
What are applets?
Need for Applets
Different ways of running an applet program
Applet API hierarchy
Life Cycle of an applet
Even Handlers for applets, mouse events, click events
18. Swing GUI
Introduction to AWT
Introduction to Swing GUI
Advantages of Swing over AWT
Swing API
Swing GUI Components
Event Handlers for Swing
Sample Calculator application using Swing GUI and Swing Event handling
19. JDBC
What is JDBC; introduction
JDBC features
JDBC Drivers
Setting up a database and creating a schema
Writing JDBC code to connect to DB
CRUD Operations with JDBC
Statement types in JDBC
Types of Rowset, ResultSet in JDBC
20. Access Modifiers in Java
What are access modifiers?
Default
Protected
Private
Public
A powerful ORM tool to design data base access layer.
Fills gaps of mismatches between OOPs and RDBMS paradigm. Also maintains adequate ultra performance of database access.
An automated, configurable persistence of java objects with tables in data base.
May not be a good solution for data-centric application which uses only stored procedures to implement business logic in the database.
Introduction to JPA and Hibernate including examplesecosio GmbH
In this talk, held as part of the Web Engineering lecture series at Vienna University of Technology, we introduce the main concepts of Java Persistence API (JPA) and Hibernate.
The first part of the presentation introduces the main principles of JDBC and outlines the major drawbacks of JDBC-based implementations. We then further outline the fundamental principles behind the concept of object relation mapping (ORM) and finally introduce JPA and Hibernate.
The lecture is accompanied by practical examples, which are available on GitHub.
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Sagar Verma
Collection Framework in Java,Generics,Input-Output in Java,Serialization,Inner Classes
Collection Framework in Java
The Collections Framework - Set Interface- List Interface - Map Interface - Queue Interface -Sorting collections using utility methods
equals () and hash Code contract in Java collections
Overriding equals and hash Code methods in Java
Generics
Generics for Collections, class and methods
Input-Output in Java
What is a stream? ,Bytes vs. Characters, Java IO API ,Reading a file; writing to a file using various APIs
Reading User input from console , PrintWriter Class
Serialization
Object Serialization , Serializable Interface , De-Serializable
Inner Classes
Inner Classes ,Member Classes, Local Classes, Anonymous Classes, Static Nested Classes
SQL for Web APIs - Simplifying Data Access for API ConsumersJerod Johnson
From Nordic APIs Platform Summit 2019 - Stockholm, Sweden
As the data world evolves, businesses are moving more of their data out of databases and into SaaS applications. Despite the migration, SQL remains a ubiquitous language for data access, so much so that many SaaS applications and non-relational cloud data stores support SQL endpoints in their APIs. While these endpoints allow users to leverage SQL queries to easily request data, there are still costly challenges to overcome when it comes to processing and managing the returned data.
In this presentation, we'll showcase popular APIs that offer SQL endpoints, explore the benefits of providing customers SQL access, and cover how standards-based drivers enable SaaS integration and self-service data access through SQL.
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Red Hat Developers
In this session, we'll talk about what's different about this generation of web applications and how a solid development approach must consider the latency, throughput, and interactivity demand by users across mobile devices, web browsers, and Internet of Things (IoT). We'll demonstrate how to include Couchbase in such applications to support a flexible data model and the easy scalability required for modern development. We'ill demonstrate how to create a full stack application focusing on the CEAN stack, which is composed of Couchbase, Express Framework, AngularJS, and Node.js.
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...Christian Tzolov
When working with BigData & IoT systems we often feel the need for a Common Query Language. The system specific languages usually require longer adoption time and are harder to integrate within the existing stacks.
To fill this gap some NoSql vendors are building SQL access to their systems. Building SQL engine from scratch is a daunting job and frameworks like Apache Calcite can help you with the heavy lifting. Calcite allow you to integrate SQL parser, cost-based optimizer, and JDBC with your NoSql system.
We will walk through the process of building a SQL access layer for Apache Geode (In-Memory Data Grid). I will share my experience, pitfalls and technical consideration like balancing between the SQL/RDBMS semantics and the design choices and limitations of the data system.
Hopefully this will enable you to add SQL capabilities to your prefered NoSQL data system.
What’s new in Java SE, EE, ME, Embedded world & new StrategyMohamed Taman
In this presentation, I have presented the history of Java EE from v1.0 to our latest Java EE 7.0, what is new and a brief introduction to each minor and major change to existing JSRs, and new JSRs with code to show simplifications and enhancements.
Also talked about our future Java EE 8 components alongside JDK 8 with major updates and JSRs, profiling concepts and more.
In addition, I have explained the IoT concepts with demo. Intro to the importance of Java Embedded systems world. With intro to Raspberry Pi and dukePad.
Agenda:
http://egjug.org/page/java_ee_7_8_and_beyond
Spring Framework 4.0 is the latest generation of the popular open source framework for Enterprise Java developers, focusing on the future with support for Java SE 8 and Java EE 7. In this presentation core Spring committer Sam Brannen will provide attendees an overview of the new enterprise features in the framework as well as new programming models made possible with the adoption of JDK 8 language features and APIs.
Specifically, this talk will cover support for lambda expressions and method references against Spring callback interfaces, JSR-310 Date-Time value types for Spring data binding and formatting, Spring's new @Conditional mechanism for activation of bean definitions, and a new WebSocket endpoint model. The presentation also provides an overview of Spring 4.0's updated support for enterprise APIs such as JMS 2.0, JPA 2.1, Bean Validation 1.1, Servlet 3.1, and JCache. Last but not least, Sam will highlight some of the major themes for the upcoming Spring Framework 4.1 release such as support for JCache 1.0 annotations, annotation-driven JMS listeners, and testing improvements.
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.
비행기 설계를 왜 통일 해야 할까?
디자인 시스템을 하는 이유
비행기들이 다 용도가 다르다...어떻게 설계하지?
맥락이 다른 페이지와 패턴
경유지까지 아직 멀었다... 언제 수리하지?
디자인 시스템을 적용하는 시점
엔지니어랑 얘기해서 정비해야하는데...어떻게 수리하지?
디자인 시스템을 적용하는 프로세스
비행기 설계가 바뀐걸 어떻게 알리지?
디자인 시스템의 전파
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
3. Agenda
• What is ORM
• Pros / Cons of JPA
• Current status in Coupang
• Alternatives of JPA
• Slick
• jOOQ
• Exposed
• Requery
4. ORM (Object Relational Mapping)
• OOP’s object graph vs Relational Database
• Focus OOP, not Relational Database
• No matter of RDBMS vendor - Same code
• Hibernate coverage is 95% over traditional SQL statements
• ORM not suitable for data centric application in performance
• Why should you use an ORM?
5. Pros of JPA
• Focus to Java Object graph & OOP
• No need to know relations and constraints of entities
• No need to know specific DB features by various vendor
• No need to know SQL, just use Java API
• Supplement by HQL or JPQL or QueryDSL
• All support for Stateful, Stateless (Default is Stateful)
6. Cons of JPA
• If you knew SQL already, JPA is wired
• Hard to learning (exponential)
• Low performance by stateful and fetch by id
• No suitable for Bulk or Set operations
• Massive Insert, Statistical Summary (Cube …)
• Non-Threadsafe Session - Low throughput
• Need to learn specific JPAVendor (Hibernate, Eclipse Link)
• HQL, @DynamicInsert, @LazyCollection
• 2nd Cache (recommend JCache (JSR-305))
7. Current Status in Coupang
• No Deep Dive
• Missing override (hashCode, equals, toString)
• No using @NatualId
• Bad Policy / Bad Design
• Every entity has Own identifier (Some case no need)
• Poor performance -> Mislead “JPA is bad”
• Apply not suitable case
• Bulk operations, Statistical operations
• No use supplement features
• StatelessSession, 2nd Cache …
9. Features in Alternatives of JPA
• Design Principle
• OOP based, Support Multi DBVendor
• No need stateful for Reference object
• Support association, inheritance, converter in JPA
• Performance
• Speed up to Plain SQL
• Stateless
• Support Asynchronous or Reactive
• Support Bulk or Batch operations
18. jOOQ
• Reflect Database Schema to generate Entity Class
• Typesfe SQL (akaTypesafe MyBatis)
• Database First (Not ORM)
• Stateless
• Need DBMS Owner Authority
• jOOQ vs Hibernate :When to choose which
19. jOOQ - typesafe SQL
SELECT * FROM BOOK
WHERE BOOK.PUBLISHED_IN = 2011
ORDER BY BOOK.TITLE
create.selectFrom(BOOK)
.where(BOOK.PUBLISHED_IN.eq(2011))
.orderBy(BOOK.TITLE)
select().from(t).where(t.a.eq(select(t2.x).from(t2));
// Type-check here: ---------------> ^^^^
select().from(t).where(t.a.eq(any(select(t2.x).from(t2)));
// Type-check here: -------------------> ^^^^
select().from(t).where(t.a.in(select(t2.x).from(t2));
// Type-check here: ---------------> ^^^^
select(t1.a).from(t1).unionAll(select(t2.a).from(t2));
// Type-check here: ----------------> ^^^^
select(t1.a, t1.b).from(t1).union(select(t2.a, t2.b).from(t2));
// Type-check here: -------------------> ^^^^^^^^^^
Predicates
Set operations
21. requery
• No reflection (apt code generation) - Fast instancing
• Fast startup & performance
• Schema generation
• Blocking / Non-blocking API (Reactive with RxJava)
• Support partial object / refresh / upsert
• Custom type converter like JPA
• Compile time entity validation
• Support almost JPA annotations
22. @Entity
abstract class AbstractPerson {
@Key @Generated int id;
@Index("name_index") // table specification
String name;
@OneToMany // relationships 1:1, 1:many, many to many
Set<Phone> phoneNumbers;
@Converter(EmailToStringConverter.class)
Email email;
@PostLoad // lifecycle callbacks
void afterLoad() { updatePeopleList(); }
// getter, setters, equals & hashCode automatically generated into Person.java
}
requery - define entity
Identifier
Entity class
Converter
Listeners
23. Result<Person> query = data
.select(Person.class)
.where(Person.NAME.lower().like("b%"))
.and(Person.AGE.gt(20))
.orderBy(Person.AGE.desc())
.limit(5)
.get();
Observable<Person> observable = data
.select(Person.class)
.orderBy(Person.AGE.desc())
.get()
.observable();
requery - query
Query by Fluent API
Reactive Programming
Cold Observable
Non blocking
24. @Entity(model = "tree")
interface TreeNode {
@get:Key
@get:Generated
val id: Long
@get:Column
var name: String
@get:ManyToOne(cascade = [DELETE])
var parent: TreeNode?
@get:OneToMany(mappedBy = "parent", cascade = [SAVE, DELETE])
val children: MutableSet<TreeNode>
}
requery - self refence by Kotlin
Identifier
Entity class
1:N, N:1
Cascade
25. requery - Blob/Clob usage
class ByteArrayBlobConverter : Converter<ByteArray, Blob> {
override fun getPersistedSize(): Int? = null
override fun getPersistedType(): Class<Blob> = Blob::class.java
override fun getMappedType(): Class<ByteArray> = ByteArray::class.java
override fun convertToMapped(type: Class<out ByteArray>?, value: Blob?): ByteArray? {
return value?.binaryStream?.readBytes()
}
override fun convertToPersisted(value: ByteArray?): Blob? {
return value?.let { SerialBlob(it) }
}
}
26. requery - Blob property
@Entity(model = "kt")
interface BigModel {
@get:Key
@get:Generated
@get:Column(name = "model_id")
val id: Int
@get:Column(name = "model_name")
var name: String?
@get:Convert(value = ByteArrayBlobConverter::class)
@get:Column(name = "model_picture")
var picture: ByteArray?
}
Blob column
28. Exposed - Kotlin SQL Framework
• Lightweight SQL Library
• Provide two layers of data access
• Typesafe SQL wrapping DSL
• Lightweight Data Access Object
• See : First steps with Kotlin/Exposed
• Cons
• Not mature
29. Exposed - SQL DSL
object Users : Table() {
val id = varchar("id", 10).primaryKey() // Column<String>
val name = varchar("name", length = 50) // Column<String>
val cityId = (integer("city_id") references Cities.id).nullable() // Column<Int?>
}
object Cities : Table() {
val id = integer("id").autoIncrement().primaryKey() // Column<Int>
val name = varchar("name", 50) // Column<String>
}
31. Exposed - SQL DSL - Join
(Users innerJoin Cities)
.slice(Users.name, Cities.name)
.select {
(Users.id.eq("andrey") or Users.name.eq("Sergey")) and
Users.id.eq("sergey") and Users.cityId.eq(Cities.id)
}
.forEach {
println("${it[Users.name]} lives in ${it[Cities.name]}")
}
32. Exposed - SQL DSL - Join 2
((Cities innerJoin Users)
.slice(Cities.name, Users.id.count())
.selectAll()
.groupBy(Cities.name))
.forEach {
val cityName = it[Cities.name]
val userCount = it[Users.id.count()]
if (userCount > 0) {
println("$userCount user(s) live(s) in $cityName")
} else {
println("Nobody lives in $cityName")
}
}
33. Exposed - DAO
object Users : IntIdTable() {
val name = varchar("name", 50).index()
val city = reference("city", Cities)
val age = integer("age")
}
object Cities: IntIdTable() {
val name = varchar("name", 50)
}
Schema Definition
class User(id: EntityID<Int>) : IntEntity(id){
companion object : IntEntityClass<User>(Users)
var name by Users.name
var city by City referencedOn Users.city
var age by Users.age
}
class City(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<City>(Cities)
var name by Cities.name
val users by User referrersOn Users.city
}
Entity Definition
34. Exposed - DAO Usage
val munich = City.new {
name = "Munich"
}
User.new {
name = "a"
city = munich
age = 5
}
User.new {
name = "b"
city = munich
age = 27
}
munich.users.joinToString { it.name }
User.find { Users.age.between(18, 60) }
OneTo Many
All user’s name in Munich
35. Conclusion
• Already legacy database exists ? Use only Java
• jOOQ or requery
• Scala only ? -> Slick
• Kotlin only ? -> requery, Exposed
• No matter language? -> requery
• Need Reactive programming? ->
• requery with kotlinx-requery
• kotlinx-rxjava2-jdbc ( we will open March )
42. Define Entity - Kotlin
@Entity(model = "functional")
interface Person: Persistable {
@get:Key
@get:Generated
val id: Long
@get:Index(value = ["idx_person_name_email"])
var name: String
@get:Index(value = ["idx_person_name_email", "idx_person_email"])
var email: String
var birthday: LocalDate
@get:Column(value = "'empty'")
var description: String?
@get:Nullable
var age: Int?
@get:ForeignKey
@get:OneToOne(mappedBy = "person", cascade = [CascadeAction.DELETE, CascadeAction.SAVE])
var address: Address?
@get:OneToMany(mappedBy = "owner", cascade = [CascadeAction.DELETE, CascadeAction.SAVE])
val phoneNumbers: MutableSet<Phone>
@get:OneToMany
val phoneNumberList: MutableList<Phone>
@get:ManyToMany(mappedBy = "members")
val groups: MutableResult<Group>
@get:ManyToMany(mappedBy = "owners")
val ownedGroups: MutableResult<Group>
@get:ManyToMany(mappedBy = "id")
@get:JunctionTable
val friends: MutableSet<Person>
@get:Lazy
var about: String?
@get:Column(unique = true)
var uuid: UUID
var homepage: URL
var picture: String
}
43. EntityDataStore<Object>
• findByKey
• select / insert / update / upsert / delete
• where / eq, lte, lt, gt, gte, like, in, not …
• groupBy / having / limit / offset
• support SQL Functions
• count, sum, avg, upper, lower …
• raw query
44. @Test
fun `insert user`() {
val user = RandomData.randomUser()
withDb(Models.DEFAULT) {
insert(user)
assertThat(user.id).isGreaterThan(0)
val loaded = select(User::class) where (User::id eq user.id) limit 10
assertThat(loaded.get().first()).isEqualTo(user)
}
}
val result = select(Location::class)
.join(User::class).on(User::location eq Location::id)
.where(User::id eq user.id)
.orderBy(Location::city.desc())
.get()
val result = raw(User::class, "SELECT * FROM Users")
val rowCount = update(UserEntity::class)
.set(UserEntity.ABOUT, "nothing")
.set(UserEntity.AGE, 50)
.where(UserEntity.AGE eq 100)
.get()
.value()
val count = insert(PersonEntity::class, PersonEntity.NAME, PersonEntity.DESCRIPTION)
.query(select(GroupEntity.NAME, GroupEntity.DESCRIPTION))
.get()
.first()
.count()
45. CoroutineEntityDataStore
val store = CoroutineEntityStore(this)
runBlocking {
val users = store.insert(RandomData.randomUsers(10))
users.await().forEach { user ->
assertThat(user.id).isGreaterThan(0)
}
store
.count(UserEntity::class)
.get()
.toDeferred()
.await()
.let {
assertThat(it).isEqualTo(10)
}
}
with(coroutineTemplate) {
val user = randomUser()
// can replace with `withContext { }`
async { insert(user) }.await()
assertThat(user.id).isNotNull()
val group = RandomData.randomGroup()
group.members.add(user)
async { insert(group) }.await()
assertThat(user.groups).hasSize(1)
assertThat(group.members).hasSize(1)
}
46. spring-data-requery
• RequeryOperations
• Wrap EntityDataStore
• RequeryTransactionManager for TransactionManager
• Support Spring @Transactional
• Better performance than spring-data-jpa
• when exists, paging, not load all entities
47. spring-data-requery
• Repository built in SQL
• ByPropertyName Auto generation methods
• @Query for Native SQL Query
• Query By Example
• Not Supported
• Association Path (not specified join method)
• Named parameter in @Query (just use `?`)
(support next version)
48. Setup spring-data-requery
@Configuration
@EnableTransactionManagement
public class RequeryTestConfiguration extends AbstractRequeryConfiguration {
@Override
@Bean
public EntityModel getEntityModel() {
return Models.DEFAULT;
}
@Override
public TableCreationMode getTableCreationMode() {
return TableCreationMode.CREATE_NOT_EXISTS;
}
@Bean
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.H2)
.build();
}
}
49. Provided Beans
@Bean
public io.requery.sql.Configuration requeryConfiguration() {
return new ConfigurationBuilder(dataSource, getEntityModel())
// .useDefaultLogging()
.setEntityCache(new EmptyEntityCache())
.setStatementCacheSize(1024)
.setBatchUpdateSize(100)
.addStatementListener(new LogbackListener())
.build();
}
@Bean
public EntityDataStore<Object> entityDataStore() {
log.info("Create EntityDataStore instance.");
return new EntityDataStore<>(requeryConfiguration());
}
@Bean
public RequeryOperations requeryOperations() {
log.info("Create RequeryTemplate instance.");
return new RequeryTemplate(entityDataStore(), requeryMappingContext());
}
EntityCache 설정Tip :
개발 시에는 EmptyEntityCache,
운영 시에는 Cache2kEntityCache 사용
50. Use @Query in Repository
interface DeclaredQueryRepository extends RequeryRepository<BasicUser, Long> {
@Query("select * from basic_user u where u.email = ?")
BasicUser findByAnnotatedQuery(String email);
@Query("select * from basic_user u where u.email like ?")
List<BasicUser> findAllByEmailMatches(String email);
@Query("select * from basic_user u limit ?")
List<BasicUser> findWithLimits(int limit);
@Query("select * from basic_user u where u.name=? and u.email=? limit 1")
BasicUser findAllBy(String name, String email);
@Query("select u.id, u.name from basic_user u where u.email=?")
List<Tuple> findAllIds(String email);
@Query("select * from basic_user u where u.birthday = ?")
List<BasicUser> findByBirthday(LocalDate birthday);
}
51. Query By Example
BasicUser user = RandomData.randomUser();
user.setName("example");
requeryTemplate.insert(user);
BasicUser exampleUser = new BasicUser();
exampleUser.setName("EXA");
ExampleMatcher matcher = matching()
.withMatcher("name", startsWith().ignoreCase())
.withIgnoreNullValues();
Example<BasicUser> example = Example.of(exampleUser, matcher);
Return<? extends Result<BasicUser>> query = buildQueryByExample(example);
BasicUser foundUser = query.get().firstOrNull();
assertThat(foundUser).isNotNull().isEqualTo(user);
52. Query by Property
List<User> findByFirstnameOrLastname(String firstname, String lastname);
List<User> findByLastnameLikeOrderByFirstnameDesc(String lastname);
List<User> findByLastnameNotLike(String lastname);
List<User> findByLastnameNot(String lastname);
List<User> findByManagerLastname(String name);
List<User> findByColleaguesLastname(String lastname);
List<User> findByLastnameNotNull();
@Query("select u.lastname from SD_User u group by u.lastname")
Page<String> findByLastnameGrouped(Pageable pageable);
long countByLastname(String lastname);
int countUsersByFirstname(String firstname);
boolean existsByLastname(String lastname);
Note: Association Path is not supported
Note: Association Path is not supported
53. Exists
static class ExistsExecution extends JpaQueryExecution {
@Override
protected Object doExecute(AbstractJpaQuery query, Object[] values) {
return !query.createQuery(values).getResultList().isEmpty();
}
}
static class ExistsExecution extends RequeryQueryExecution {
@Override
protected @Nullable Object doExecute(AbstractRequeryQuery query, Object[] values) {
Result<?> result = (Result<?>) query.createQueryElement(values).limit(1).get();
return result.firstOrNull() != null;
}
}
Spring Data JPA - ExistsExecution
Spring Data Requery - ExistsExecution
54. Delete in JPA
static class DeleteExecution extends JpaQueryExecution {
private final EntityManager em;
public DeleteExecution(EntityManager em) {
this.em = em;
}
@Override
protected Object doExecute(AbstractJpaQuery jpaQuery, Object[] values) {
Query query = jpaQuery.createQuery(values);
List<?> resultList = query.getResultList();
for (Object o : resultList) {
em.remove(o);
}
return jpaQuery.getQueryMethod().isCollectionQuery() ? resultList : resultList.size();
}
}
Spring Data JPA - DeleteExecution
Load all entities to delete for
cascading delete
55. Delete in requery
static class DeleteExecution extends RequeryQueryExecution {
private final RequeryOperations operations;
DeleteExecution(@NotNull RequeryOperations operations) {
Assert.notNull(operations, "operations must not be null!");
this.operations = operations;
}
@SuppressWarnings("unchecked")
@Override
protected @Nullable Object doExecute(AbstractRequeryQuery query, Object[] values) {
QueryElement<?> whereClause = query.createQueryElement(values);
QueryElement<?> deleteQuery = applyWhereClause((QueryElement<?>) operations.delete(query.getDomainClass()),
whereClause.getWhereElements());
Scalar<Integer> result = ((QueryElement<? extends Scalar<Integer>>) deleteQuery).get();
return result.value();
}
}
Spring Data Requery - DeleteExecution
Use delete statements directly
cascading depends on DB
56. Future works
• Support Named parameter (ready)
• Support `@Param` in spring data
• Support complecated aggregation operations
• Requery for Apache Phoenix (done)
• CoroutineEntityStore (testing)
57. Resources
• requery.io
• spring-data-requery in github
• 2.0.x for spring-data-commons 2.0.x
• 2.1.x for spring-data-commons 2.1.x