Using batch processing
Batch processing is the last recipe of this chapter. Running background tasks is a useful and important skill in an enterprise context.
You could use it to process data in bulk or just to separate it from the UI processes. This recipe will show you how to do it.
Getting ready
Let's add our dependencies:
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>5.2.10.Final</version> <scope>runtime</scope> </dependency> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency>
How to do it...
- We first define our persistence unit:
<persistence-unit name="ch02-batch-pu" > <provider>org.hibernate...