Production « Test « JPA Q&A

1. Supporting Different JPA GenerationTypes for Test/Production

I want to use GenerationType.IDENTITY for primary keys in my production MySQL system. But for local development and testing, I'd like to use HSQLDB. The problem is that HSQLDB doesn't support ...

2. How to define two persistence units (one for production, one for unit testing)?

This is my stateless bean:

public class Finder {
  @PersistenceContext(unitName = "production")
  EntityManager em;
It explicitly defines that the name of persistence unit is production. This unit is configured ...

3. Best practice to get EntityManger for either Test or Production

I'm creating a JPA-based application, and I need the EntityManger in a lot of diffferent places. So I'm creating a singleton class that returns the entity manager:

class MyDB {

4. configuring hibernate for production and testing

In my web app,I am using hibernate and hsqldb for database operations..and use Ant for build management.I have a containing db.url,db.driver etc.They contain production db values. In hibernate.cfg.xml ,I am again ...

5. How to connect to different databases (development/test/production) transparently with hibernate

I have several different databases for different environments to connect my application to. These are constant per installation but differ between them. In other words there is

  1. A development environment which connects ...