JPA performance

http://java-persistence-performance.blogspot.ro/2011/06/how-to-improve-jpa-performance-by-1825.html#
http://spitballer.blogspot.ro/2010/04/jpa-persisting-vs-merging-entites.html

Use byte code weaving
EclipseLink implements LAZY for OneToOne and ManyToOne relationships using byte code weaving

Pagination
Use setFirstResult, setMaxResults of javax.persistence.Query.

Caching
See https://docs.oracle.com/javaee/7/tutorial/persistence-cache001.htm#GKJIO.
See  in persistence.xml or javax.persistence.sharedCache.mode property when creating the EntityManagerFactory.
See javax.persistence.Cacheable used to annotate an entity.

JDBC batching (insert/update only)
See http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#batch.
hibernate.jdbc.batch_size: a non-zero value enables use of JDBC2 batch updates by Hibernate. e.g. recommended values between 5 and 30

JDBC fetch size (retrieve only)
hibernate.jdbc.fetch_size: a non-zero value determines the JDBC fetch size (calls Statement.setFetchSize())
Statement.setFetchSize: gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for ResultSet objects genrated by this Statement. If the value specified is zero, then the hint is ignored. The default value is zero.
In my opinion the best explanation is here: https://docs.oracle.com/cd/E11882_01/java.112/e16548/resltset.htm#JJDBC28621
Excerpt: Standard JDBC also enables you to specify the number of rows fetched with each database round-trip for a query, and this number is referred to as the fetch size.

Hibernate batch size (@BatchSize)
http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#performance-fetching
@BatchSize specifies a "batch size" for fetching instances of this class by identifier. Not yet loaded instances are loaded batch-size at a time (default 1).

Hibernate fetching strategies (@Fetch)
http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#performance-fetching
http://www.mkyong.com/hibernate/hibernate-fetching-strategies-examples/
Fetching strategies: join fetching, select fetching, subselect fetching, batch fetching.

other
http://www.jroller.com/eyallupu/entry/solving_the_simultaneously_fetch_multiple1

hibernate.default_batch_fetch_size
http://stackoverflow.com/questions/21162172/default-batch-fetch-size-recommended-values
http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch03.html
see also hibernate.batch_fetch_style at http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#performance-fetching
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/loader/BatchFetchStyle.java specifies LEGACY as the default for hibernate.batch_fetch_style