I am very new using JUnit. I want to test some classes that implements JPA. But, I have two databases, one for testing and other for development.
Normally, the testing db is clean. I test inserts, updates, delets, so and so, but any time I have to switch the db connection to testing db.
How can I have two persistence units: one for testing and other for development?
Thanks…
You can either have two different persistence units in your persistence.xml file, or you can have one, and create your EntityManagerFactory passing in a properties map that override the database parameters.
Your entities/mappings can be the same for both.