SlideShare a Scribd company logo
Performance Tuning
with
JPA 2.1 and Hibernate
Thorben Janssen
Thorben Janssen (@thjanssen123), 23rd
October 2015
Thorben Janssen
• Independent author and trainer
• Senior developer and architect @ Qualitype GmbH
• CDI 2.0 expert group member
• Twitter: @thjanssen123
• Blog: www.thoughts-on-java.org
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Performance
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Performance
• Recognize performance problems as early as possible
• Typical causes for performance problems
• Solving performance problems
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Hibernate Statistics
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Hibernate Statistics
• Activate via system property
• hibernate.generate_statistics = true
• Configure logging
• org.hibernate.stat = DEBUG
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Hibernate Statistics
• 08:24:10,916 DEBUG [org.hibernate.stat.internal.ConcurrentStatisticsImpl]
(default task-1) HHH000117: HQL: SELECT a FROM Author a WHERE a.lastName
= :lastName, time: 6ms, rows: 1
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Time spend
for this query Number of
returned rows
Hibernate Statistics
08:08:04,960 INFO [org.hibernate.engine.internal.StatisticalLoggingSessionEventListener] (default
task-2) Session Metrics {
1191522 nanoseconds spent acquiring 4 JDBC connections;
433875 nanoseconds spent releasing 4 JDBC connections;
4404058 nanoseconds spent preparing 6 JDBC statements;
12458725 nanoseconds spent executing 6 JDBC statements;
0 nanoseconds spent executing 0 JDBC batches;
0 nanoseconds spent performing 0 L2C puts;
0 nanoseconds spent performing 0 L2C hits;
0 nanoseconds spent performing 0 L2C misses;
586896 nanoseconds spent executing 1 flushes (flushing a total of 2 entities and 2 collections);
39434974 nanoseconds spent executing 1 partial-flushes (flushing a total of 2 entities and 2
collections)
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Number of statements
Cache usage
Time spend for
statements
Typical causes for
performance problems
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Typical Causes
• Slow SELECT statements
• Wrong FetchType
• Load same data multiple times
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Slow SELECT-statements
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Slow SELECTs
• In general no „real“ JPA or Hibernate problem
• Check generated SQL
• Check execution plan of the statement
• Check indexes
• Optimize SELECT statement
• Consider to use a native query
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Native Query
• Reasons to use native queries:
• JPQL supports only a subset of SQL
• Database specific features
• Native queries return an Object[] for each row
• Needs to be mapped programmatically or declaratively
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
SqlResultSetMapping
• Declarative mapping of query results
@SqlResultSetMapping(
name = "myResultMapping ",
entities = {@EntityResult(...), …},
classes= {@ConstructorResult (…), …},
columns = {@ColumnResult(…), …}
)
this.em.createNativeQuery(“Select …", "myResultMapping")
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
SqlResultSetMapping
@SqlResultSetMapping(
name = "myResultMapping",
entities = {@EntityResult(
entityClass = Author.class,
fields = {
@FieldResult(name = "id", column = „autId"),
…}
),
…},
classes= {@ConstructorResult (…), …},
columns = {@ColumnResult(…), …}
)
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
SqlResultSetMapping
@SqlResultSetMapping(
name = "myResultMapping",
entities = {@EntityResult(...), …},
classes= {@ConstructorResult(
targetClass = BookPublisherValue.class,
columns = {
@ColumnResult(name = "title"),
…}
),
…},
columns = {@ColumnResult(…), …}
)
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
SqlResultSetMapping
@SqlResultSetMapping(
name = "myResultMapping",
entities = {@EntityResult(...), …},
classes= {@ConstructorResult(...), …},
columns = {@ColumnResult(
name = "bookCount",
type = Long.class),
…},
)
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
FetchType
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
FetchType
• Defines when the relationship will be fetched
• Static definition in entity mapping
@ManyToMany(mappedBy="authors", fetch = FetchType.EAGER)
private Set<Book> books;
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
FetchType
• Lazy
• Relationship gets loaded at first access
• Default for to-many relationships
• Eager
• Loads relationships immediately
• Default for to-one relationships
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Recommendations
• To-many relationships
• Stick to the default mapping (FetchType.LAZY)
• Use eager fetching for specific queries, if required
• To-one relationships
• Check individually
• Default is fine in most of the cases
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Query Specific Fetching
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Query Specific Fetching
• Fetch all required entities with one query
• Fetch Joins
• @NamedEntityGraph
• EntityGraph
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Query Specific Fetching
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Fetch Join
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Fetch Join
• Use JOIN FETCH instead of JOIN in JPQL query
List<Author> authors = this.em.createQuery(
"SELECT DISTINCT a FROM Author a JOIN FETCH a.books b",
Author.class).getResultList();
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Fetch Join
• Advantages
• Relationships gets loaded in same query
• Disadvantages
• Requires a special query for each use case
• Creates cartesian product
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
@NamedEntityGraph
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
@NamedEntityGraph
• Introduced in JPA 2.1
• Declaratively defines a graph of entities which will be loaded
• Graph is query independent
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
@NamedEntityGraph
• Define a @NamedEntityGraph
@NamedEntityGraph(
name = "graph.AuthorBooksReviews",
attributeNodes =
@NamedAttributeNode(value = "books")
)
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
@NamedEntityGraph
• Define a @NamedEntityGraph
@NamedEntityGraph(
name = "graph.AuthorBooksReviews",
attributeNodes =
@NamedAttributeNode(value = "books", subgraph = "books"),
subgraphs =
@NamedSubgraph(
name = "books",
attributeNodes = @NamedAttributeNode("reviews")))
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
@NamedEntityGraph
• Provide entity graph es hint
EntityGraph graph = this.em.getEntityGraph("graph.AuthorBooks");
this.em.createQuery("SELECT DISTINCT a FROM Author a")
.setHint("javax.persistence.loadgraph", graph);
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
@NamedEntityGraph
• Fetch graph
• Eager loading for all elements of the graph
• Lazy loading for all other attributes
• Load graph
• Eager loading for all elements of the graph
• Loads all other attributes with their defined FetchType
• Hibernate always uses a load graph
• HHH-8776
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
@NamedEntityGraph
• Advantages
• Relationships gets loaded in same query
• Definition of the graph is independent of the query
• Disadvantages
• Creates cartesian product
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
EntityGraph
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
EntityGraph
• Introduced in JPA 2.1
• Dynamic version of @NamedEntityGraph
• Definition via Java API
• Graph is query independent
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
EntityGraph
• Define and use EntityGraph
EntityGraph graph = this.em.createEntityGraph(Author.class);
Subgraph<Book> bookSubGraph = graph.addSubgraph(Author_.books);
bookSubGraph.addSubgraph(Book_.reviews);
this.em.createQuery("SELECT DISTINCT a FROM Author a")
.setHint("javax.persistence.loadgraph", graph);
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
EntityGraph
• Advantages
• Relationships gets loaded in same query
• Definition of the graph is independent of the query
• Dynamic creation at runtime
• Disadvantages
• Creates cartesian product
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Caching
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Caching
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
1st
Level
Cache
Hibernate
Session
1st
Level
Cache
Hibernate
Session
2nd
Level
Cache
Query
Cache
DB
1st Level Cache
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
1st Level Cache
• Activated by default
• Linked to the Hibernate session
• Stores all entities that were used within a session
• Transparent usage
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
2nd Level Cache
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
2nd Level Cache
• Session independent entity store
• Needs to be activated
• persistence.xml or EntityManagerFactory
• Transparent usage
• PersistenceProvider doesn‘t need to provide it
• Not always portable
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
2nd Level Cache
• Shared Cache Mode
• ALL cache all entities
• NONE cache no entities
• ENABLE_SELECTIVE cache needs to be activated for specific entities
• DISABLE_SELECTIVE cache can be deactivated for specific entities
• UNSPECIFIED use default settings of the PersistenceProvider
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
2nd Level Cache
• Cache configuration
• Cache Retrieve Mode
• How to read entities from the cache
• Cache Store Mode
• How to write entities to the cache
• Concurrency Strategy
• How to handle concurrent access
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Query Cache
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Query Cache
• Stores query results for a query and its parameters
• [„FROM Author WHERE id=?“, 1]  [1]
• Stores only entity references or scalars
• Always use together with 2nd Level Cache
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Query Cache
• Hibernate specific
• Stores query result session independent
• Needs to be activated
• persistence.xml: hibernate.cache.use_query_cache = true
• Activate caching for a specific query
org.hibernate.Query.setCacheable(true)
@NamedQuery(… hints = @QueryHint(name="org.hibernate.cacheable",
value="true"))
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Recommendations
• Only cache data that is seldom updated
• Always benchmark the application when adding or changing caching
• Use Query Cache together with 2nd Level Cache
• Configuration has to fit to each other
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Resources
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Resources
• JSR 338: JavaTM Persistence API, Version 2.1
http://download.oracle.com/otndocs/jcp/persistence-2_1-fr-eval-spec/index.html
• Hibernate Reference Documentation
http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/
• Hibernate Developer Guide http://docs.jboss.org/hibernate/orm/4.3/devguide/en-
US/html/
• Hibernate ORM: Tips, Tricks and Performance Techniques by Brett Meyer
http://de.slideshare.net/brmeyer/hibernate-orm-performance-31550150
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Resources
• Java Persistence with Hibernate Second Edition by Christian Bauer, Gaving King, Gary
Gregory
• Java Platform, Enterprise Edition: The Java EE Tutorial
https://docs.oracle.com/javaee/7/tutorial/index.html
• Hibernate: Truly Understanding the Second-Level and Query Caches
http://www.javalobby.org/java/forums/t48846.html
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Presentation & Cheat
Sheet
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015
Presentation & Cheat Sheet
• Get this presentation and a handy cheat sheet with all the discussed performance
tuning tips at
http://www.thoughts-on-java.org/geecon2015/
Thorben Janssen (@thjanssen123) Prague, 23rd
October 2015

More Related Content

What's hot

Java EE revisits design patterns
Java EE revisits design patternsJava EE revisits design patterns
Java EE revisits design patterns
Alex Theedom
 
Javasession6
Javasession6Javasession6
Javasession6
Rajeev Kumar
 
Our Tale from the Trail of Shadows at REI Co-op - Chris Phillips & Dale Smith...
Our Tale from the Trail of Shadows at REI Co-op - Chris Phillips & Dale Smith...Our Tale from the Trail of Shadows at REI Co-op - Chris Phillips & Dale Smith...
Our Tale from the Trail of Shadows at REI Co-op - Chris Phillips & Dale Smith...
Lucidworks
 
How to train the jdt dragon
How to train the jdt dragonHow to train the jdt dragon
How to train the jdt dragon
Ayushman Jain
 
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
Leonardo De Moura Rocha Lima
 
Unit Testing with WOUnit
Unit Testing with WOUnitUnit Testing with WOUnit
Unit Testing with WOUnit
WO Community
 
Java EE Revisits Design Patterns
Java EE Revisits Design PatternsJava EE Revisits Design Patterns
Java EE Revisits Design Patterns
Alex Theedom
 
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
Leonardo De Moura Rocha Lima
 
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
Leonardo De Moura Rocha Lima
 
Bio solr building a better search for bioinformatics
Bio solr   building a better search for bioinformaticsBio solr   building a better search for bioinformatics
Bio solr building a better search for bioinformatics
Charlie Hull
 
New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1
Stefan Schmidt
 
Advance Java Training in Bangalore | Best Java Training Institute
Advance Java Training in Bangalore | Best Java Training Institute Advance Java Training in Bangalore | Best Java Training Institute
Advance Java Training in Bangalore | Best Java Training Institute
TIB Academy
 
Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)
Sander Mak (@Sander_Mak)
 
Buidling large scale recommendation engine
Buidling large scale recommendation engineBuidling large scale recommendation engine
Buidling large scale recommendation engine
Keeyong Han
 
Lucene And Solr Document Classification
Lucene And Solr Document ClassificationLucene And Solr Document Classification
Lucene And Solr Document Classification
Alessandro Benedetti
 
Solr vs ElasticSearch
Solr vs ElasticSearchSolr vs ElasticSearch
Solr vs ElasticSearch
Dikshant Shahi
 
Solr: 4 big features
Solr: 4 big featuresSolr: 4 big features
Solr: 4 big features
David Smiley
 
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Udit Gangwani
 
Webinar: What's New in Solr 7
Webinar: What's New in Solr 7 Webinar: What's New in Solr 7
Webinar: What's New in Solr 7
Lucidworks
 
Building a real time, solr-powered recommendation engine
Building a real time, solr-powered recommendation engineBuilding a real time, solr-powered recommendation engine
Building a real time, solr-powered recommendation engine
Trey Grainger
 

What's hot (20)

Java EE revisits design patterns
Java EE revisits design patternsJava EE revisits design patterns
Java EE revisits design patterns
 
Javasession6
Javasession6Javasession6
Javasession6
 
Our Tale from the Trail of Shadows at REI Co-op - Chris Phillips & Dale Smith...
Our Tale from the Trail of Shadows at REI Co-op - Chris Phillips & Dale Smith...Our Tale from the Trail of Shadows at REI Co-op - Chris Phillips & Dale Smith...
Our Tale from the Trail of Shadows at REI Co-op - Chris Phillips & Dale Smith...
 
How to train the jdt dragon
How to train the jdt dragonHow to train the jdt dragon
How to train the jdt dragon
 
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
 
Unit Testing with WOUnit
Unit Testing with WOUnitUnit Testing with WOUnit
Unit Testing with WOUnit
 
Java EE Revisits Design Patterns
Java EE Revisits Design PatternsJava EE Revisits Design Patterns
Java EE Revisits Design Patterns
 
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
 
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
 
Bio solr building a better search for bioinformatics
Bio solr   building a better search for bioinformaticsBio solr   building a better search for bioinformatics
Bio solr building a better search for bioinformatics
 
New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1
 
Advance Java Training in Bangalore | Best Java Training Institute
Advance Java Training in Bangalore | Best Java Training Institute Advance Java Training in Bangalore | Best Java Training Institute
Advance Java Training in Bangalore | Best Java Training Institute
 
Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)
 
Buidling large scale recommendation engine
Buidling large scale recommendation engineBuidling large scale recommendation engine
Buidling large scale recommendation engine
 
Lucene And Solr Document Classification
Lucene And Solr Document ClassificationLucene And Solr Document Classification
Lucene And Solr Document Classification
 
Solr vs ElasticSearch
Solr vs ElasticSearchSolr vs ElasticSearch
Solr vs ElasticSearch
 
Solr: 4 big features
Solr: 4 big featuresSolr: 4 big features
Solr: 4 big features
 
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
 
Webinar: What's New in Solr 7
Webinar: What's New in Solr 7 Webinar: What's New in Solr 7
Webinar: What's New in Solr 7
 
Building a real time, solr-powered recommendation engine
Building a real time, solr-powered recommendation engineBuilding a real time, solr-powered recommendation engine
Building a real time, solr-powered recommendation engine
 

Similar to Performance Tuning with JPA 2.1 and Hibernate (Geecon Prague 2015)

Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und HibernateEffiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
Thorben Janssen
 
Doctrine Data migrations | May 2017
Doctrine Data migrations | May 2017Doctrine Data migrations | May 2017
Doctrine Data migrations | May 2017
Petr Bechyně
 
Python programming
Python programmingPython programming
Python programming
sirikeshava
 
Real-time Data Processing
Real-time Data ProcessingReal-time Data Processing
Real-time Data Processing
Bryan Warner
 
20181019 code.talks graph_analytics_k_patenge
20181019 code.talks graph_analytics_k_patenge20181019 code.talks graph_analytics_k_patenge
20181019 code.talks graph_analytics_k_patenge
Karin Patenge
 
IRE2014 Filtering Tweets Related to an entity
IRE2014 Filtering Tweets Related to an entityIRE2014 Filtering Tweets Related to an entity
IRE2014 Filtering Tweets Related to an entity
kartik179
 
xpaths.pptx
xpaths.pptxxpaths.pptx
xpaths.pptx
KundetiLeena1
 
Matplotlib_Complete review_2021_abridged_version
Matplotlib_Complete review_2021_abridged_versionMatplotlib_Complete review_2021_abridged_version
Matplotlib_Complete review_2021_abridged_version
Bhaskar J.Roy
 
Matplotlib Review 2021
Matplotlib Review 2021Matplotlib Review 2021
Matplotlib Review 2021
Bhaskar J.Roy
 
Machine Learning with ML.NET
Machine Learning with ML.NETMachine Learning with ML.NET
Machine Learning with ML.NET
Hossein Zahed
 
Microdata for Dummies
Microdata for DummiesMicrodata for Dummies
Microdata for Dummies
giurca
 
Google App Engine - exploiting limitations
Google App Engine - exploiting limitationsGoogle App Engine - exploiting limitations
Google App Engine - exploiting limitations
Tomáš Holas
 

Similar to Performance Tuning with JPA 2.1 and Hibernate (Geecon Prague 2015) (12)

Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und HibernateEffiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
 
Doctrine Data migrations | May 2017
Doctrine Data migrations | May 2017Doctrine Data migrations | May 2017
Doctrine Data migrations | May 2017
 
Python programming
Python programmingPython programming
Python programming
 
Real-time Data Processing
Real-time Data ProcessingReal-time Data Processing
Real-time Data Processing
 
20181019 code.talks graph_analytics_k_patenge
20181019 code.talks graph_analytics_k_patenge20181019 code.talks graph_analytics_k_patenge
20181019 code.talks graph_analytics_k_patenge
 
IRE2014 Filtering Tweets Related to an entity
IRE2014 Filtering Tweets Related to an entityIRE2014 Filtering Tweets Related to an entity
IRE2014 Filtering Tweets Related to an entity
 
xpaths.pptx
xpaths.pptxxpaths.pptx
xpaths.pptx
 
Matplotlib_Complete review_2021_abridged_version
Matplotlib_Complete review_2021_abridged_versionMatplotlib_Complete review_2021_abridged_version
Matplotlib_Complete review_2021_abridged_version
 
Matplotlib Review 2021
Matplotlib Review 2021Matplotlib Review 2021
Matplotlib Review 2021
 
Machine Learning with ML.NET
Machine Learning with ML.NETMachine Learning with ML.NET
Machine Learning with ML.NET
 
Microdata for Dummies
Microdata for DummiesMicrodata for Dummies
Microdata for Dummies
 
Google App Engine - exploiting limitations
Google App Engine - exploiting limitationsGoogle App Engine - exploiting limitations
Google App Engine - exploiting limitations
 

Recently uploaded

Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
Fwdays
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
Vadym Kazulkin
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
ScyllaDB
 

Recently uploaded (20)

Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
 

Performance Tuning with JPA 2.1 and Hibernate (Geecon Prague 2015)

  • 1. Performance Tuning with JPA 2.1 and Hibernate Thorben Janssen Thorben Janssen (@thjanssen123), 23rd October 2015
  • 2. Thorben Janssen • Independent author and trainer • Senior developer and architect @ Qualitype GmbH • CDI 2.0 expert group member • Twitter: @thjanssen123 • Blog: www.thoughts-on-java.org Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 4. Performance • Recognize performance problems as early as possible • Typical causes for performance problems • Solving performance problems Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 5. Hibernate Statistics Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 6. Hibernate Statistics • Activate via system property • hibernate.generate_statistics = true • Configure logging • org.hibernate.stat = DEBUG Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 7. Hibernate Statistics • 08:24:10,916 DEBUG [org.hibernate.stat.internal.ConcurrentStatisticsImpl] (default task-1) HHH000117: HQL: SELECT a FROM Author a WHERE a.lastName = :lastName, time: 6ms, rows: 1 Thorben Janssen (@thjanssen123) Prague, 23rd October 2015 Time spend for this query Number of returned rows
  • 8. Hibernate Statistics 08:08:04,960 INFO [org.hibernate.engine.internal.StatisticalLoggingSessionEventListener] (default task-2) Session Metrics { 1191522 nanoseconds spent acquiring 4 JDBC connections; 433875 nanoseconds spent releasing 4 JDBC connections; 4404058 nanoseconds spent preparing 6 JDBC statements; 12458725 nanoseconds spent executing 6 JDBC statements; 0 nanoseconds spent executing 0 JDBC batches; 0 nanoseconds spent performing 0 L2C puts; 0 nanoseconds spent performing 0 L2C hits; 0 nanoseconds spent performing 0 L2C misses; 586896 nanoseconds spent executing 1 flushes (flushing a total of 2 entities and 2 collections); 39434974 nanoseconds spent executing 1 partial-flushes (flushing a total of 2 entities and 2 collections) Thorben Janssen (@thjanssen123) Prague, 23rd October 2015 Number of statements Cache usage Time spend for statements
  • 9. Typical causes for performance problems Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 10. Typical Causes • Slow SELECT statements • Wrong FetchType • Load same data multiple times Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 11. Slow SELECT-statements Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 12. Slow SELECTs • In general no „real“ JPA or Hibernate problem • Check generated SQL • Check execution plan of the statement • Check indexes • Optimize SELECT statement • Consider to use a native query Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 13. Native Query • Reasons to use native queries: • JPQL supports only a subset of SQL • Database specific features • Native queries return an Object[] for each row • Needs to be mapped programmatically or declaratively Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 14. SqlResultSetMapping • Declarative mapping of query results @SqlResultSetMapping( name = "myResultMapping ", entities = {@EntityResult(...), …}, classes= {@ConstructorResult (…), …}, columns = {@ColumnResult(…), …} ) this.em.createNativeQuery(“Select …", "myResultMapping") Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 15. SqlResultSetMapping @SqlResultSetMapping( name = "myResultMapping", entities = {@EntityResult( entityClass = Author.class, fields = { @FieldResult(name = "id", column = „autId"), …} ), …}, classes= {@ConstructorResult (…), …}, columns = {@ColumnResult(…), …} ) Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 16. SqlResultSetMapping @SqlResultSetMapping( name = "myResultMapping", entities = {@EntityResult(...), …}, classes= {@ConstructorResult( targetClass = BookPublisherValue.class, columns = { @ColumnResult(name = "title"), …} ), …}, columns = {@ColumnResult(…), …} ) Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 17. SqlResultSetMapping @SqlResultSetMapping( name = "myResultMapping", entities = {@EntityResult(...), …}, classes= {@ConstructorResult(...), …}, columns = {@ColumnResult( name = "bookCount", type = Long.class), …}, ) Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 18. FetchType Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 19. FetchType • Defines when the relationship will be fetched • Static definition in entity mapping @ManyToMany(mappedBy="authors", fetch = FetchType.EAGER) private Set<Book> books; Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 20. FetchType • Lazy • Relationship gets loaded at first access • Default for to-many relationships • Eager • Loads relationships immediately • Default for to-one relationships Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 21. Recommendations • To-many relationships • Stick to the default mapping (FetchType.LAZY) • Use eager fetching for specific queries, if required • To-one relationships • Check individually • Default is fine in most of the cases Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 22. Query Specific Fetching Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 23. Query Specific Fetching • Fetch all required entities with one query • Fetch Joins • @NamedEntityGraph • EntityGraph Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 24. Query Specific Fetching Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 25. Fetch Join Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 26. Fetch Join • Use JOIN FETCH instead of JOIN in JPQL query List<Author> authors = this.em.createQuery( "SELECT DISTINCT a FROM Author a JOIN FETCH a.books b", Author.class).getResultList(); Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 27. Fetch Join • Advantages • Relationships gets loaded in same query • Disadvantages • Requires a special query for each use case • Creates cartesian product Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 29. @NamedEntityGraph • Introduced in JPA 2.1 • Declaratively defines a graph of entities which will be loaded • Graph is query independent Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 30. @NamedEntityGraph • Define a @NamedEntityGraph @NamedEntityGraph( name = "graph.AuthorBooksReviews", attributeNodes = @NamedAttributeNode(value = "books") ) Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 31. @NamedEntityGraph • Define a @NamedEntityGraph @NamedEntityGraph( name = "graph.AuthorBooksReviews", attributeNodes = @NamedAttributeNode(value = "books", subgraph = "books"), subgraphs = @NamedSubgraph( name = "books", attributeNodes = @NamedAttributeNode("reviews"))) Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 32. @NamedEntityGraph • Provide entity graph es hint EntityGraph graph = this.em.getEntityGraph("graph.AuthorBooks"); this.em.createQuery("SELECT DISTINCT a FROM Author a") .setHint("javax.persistence.loadgraph", graph); Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 33. @NamedEntityGraph • Fetch graph • Eager loading for all elements of the graph • Lazy loading for all other attributes • Load graph • Eager loading for all elements of the graph • Loads all other attributes with their defined FetchType • Hibernate always uses a load graph • HHH-8776 Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 34. @NamedEntityGraph • Advantages • Relationships gets loaded in same query • Definition of the graph is independent of the query • Disadvantages • Creates cartesian product Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 35. EntityGraph Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 36. EntityGraph • Introduced in JPA 2.1 • Dynamic version of @NamedEntityGraph • Definition via Java API • Graph is query independent Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 37. EntityGraph • Define and use EntityGraph EntityGraph graph = this.em.createEntityGraph(Author.class); Subgraph<Book> bookSubGraph = graph.addSubgraph(Author_.books); bookSubGraph.addSubgraph(Book_.reviews); this.em.createQuery("SELECT DISTINCT a FROM Author a") .setHint("javax.persistence.loadgraph", graph); Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 38. EntityGraph • Advantages • Relationships gets loaded in same query • Definition of the graph is independent of the query • Dynamic creation at runtime • Disadvantages • Creates cartesian product Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 39. Caching Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 40. Caching Thorben Janssen (@thjanssen123) Prague, 23rd October 2015 1st Level Cache Hibernate Session 1st Level Cache Hibernate Session 2nd Level Cache Query Cache DB
  • 41. 1st Level Cache Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 42. 1st Level Cache • Activated by default • Linked to the Hibernate session • Stores all entities that were used within a session • Transparent usage Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 43. 2nd Level Cache Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 44. 2nd Level Cache • Session independent entity store • Needs to be activated • persistence.xml or EntityManagerFactory • Transparent usage • PersistenceProvider doesn‘t need to provide it • Not always portable Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 45. 2nd Level Cache • Shared Cache Mode • ALL cache all entities • NONE cache no entities • ENABLE_SELECTIVE cache needs to be activated for specific entities • DISABLE_SELECTIVE cache can be deactivated for specific entities • UNSPECIFIED use default settings of the PersistenceProvider Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 46. 2nd Level Cache • Cache configuration • Cache Retrieve Mode • How to read entities from the cache • Cache Store Mode • How to write entities to the cache • Concurrency Strategy • How to handle concurrent access Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 47. Query Cache Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 48. Query Cache • Stores query results for a query and its parameters • [„FROM Author WHERE id=?“, 1]  [1] • Stores only entity references or scalars • Always use together with 2nd Level Cache Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 49. Query Cache • Hibernate specific • Stores query result session independent • Needs to be activated • persistence.xml: hibernate.cache.use_query_cache = true • Activate caching for a specific query org.hibernate.Query.setCacheable(true) @NamedQuery(… hints = @QueryHint(name="org.hibernate.cacheable", value="true")) Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 50. Recommendations • Only cache data that is seldom updated • Always benchmark the application when adding or changing caching • Use Query Cache together with 2nd Level Cache • Configuration has to fit to each other Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 51. Resources Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 52. Resources • JSR 338: JavaTM Persistence API, Version 2.1 http://download.oracle.com/otndocs/jcp/persistence-2_1-fr-eval-spec/index.html • Hibernate Reference Documentation http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ • Hibernate Developer Guide http://docs.jboss.org/hibernate/orm/4.3/devguide/en- US/html/ • Hibernate ORM: Tips, Tricks and Performance Techniques by Brett Meyer http://de.slideshare.net/brmeyer/hibernate-orm-performance-31550150 Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 53. Resources • Java Persistence with Hibernate Second Edition by Christian Bauer, Gaving King, Gary Gregory • Java Platform, Enterprise Edition: The Java EE Tutorial https://docs.oracle.com/javaee/7/tutorial/index.html • Hibernate: Truly Understanding the Second-Level and Query Caches http://www.javalobby.org/java/forums/t48846.html Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 54. Presentation & Cheat Sheet Thorben Janssen (@thjanssen123) Prague, 23rd October 2015
  • 55. Presentation & Cheat Sheet • Get this presentation and a handy cheat sheet with all the discussed performance tuning tips at http://www.thoughts-on-java.org/geecon2015/ Thorben Janssen (@thjanssen123) Prague, 23rd October 2015