November 2018
Intermediate to advanced
388 pages
9h 5m
English
Persistence units are used to define different data sources and actions that will be applied to the data source when the application starts up.
Let's create a persistence unit in our persistence XML file:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="local" transaction-type="RESOURCE_LOCAL"> <properties> <property name ="javax.persistence.schema-generation.database.action" value="drop-and-create"/> </properties> </persistence-unit></persistence>
Here, we have just specified one persistence unit in our ...
Read now
Unlock full access