- We first define our persistence unit:
<persistence-unit name="ch02-batch-pu" > <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <jta-data-source>java:app/userDb</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="javax.persistence.schema- generation.database.action" value="create"/> <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform .internal.SunOneJtaPlatform"/> </properties> </persistence-unit>
- Then we declare a User entity:
@Entity@Table(name = "UserTab")public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @NotNull private Integer id; private String name; ...