Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

As of OpenEJB 3.1.1, you have the ability to specify an alternate set of deployment descriptors to use for a given environment. This is focused mostly on testing where it is often desirable to use a slightly different configuration for a set of tests or even specific testsa specific test.

Note
titleWhen nothing else does the trick

Note that this approach was added as a catch-all for when one of the simpler overriding techniques will not work. For the common case of needing to tweak your persistence.xml, see the Configuring PersistenceUnits in Tests page for a simpler approach.

For many reasons it is very inconvenient to have to maintain two sets of descriptors, one for production and one for testing. We aggressively add features based on user feedback and questions. If you are looking for a way to solve a problem without duplicating entire descriptors, please let us know. You should never have to go the long way to do something simple.

openejb.altdd.prefix

To use this functionality, just set the new "openejb.altdd.prefix" system property or InitialContext property to something like "test", then any descriptors in your META-INF/ directory that start with "test." will override the regular descriptor. So for example with an app like this:

...