It's fairly simple to test JPA logic. You will need to ensure that you are deploying to a nearly complete container. You won't need to deploy JPA applications to a CDI embedded container; you need the resources of your application server – managed database connection's transaction support.
Assuming that you have an EJB that exposes your DAO, it's fairly simple to create test data and load it to your database. In simple terms, one way you can do this is to create the test data in the first step of a test and then use that data in the subsequent tests, finally deleting it when the test is over. One thing to keep in mind is that you should make sure you always work off a clean database and that you create and drop your test database with each test. Let's consider a simple persistence.xml
file:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=...