TomEE and finer RESOURCE_LOCAL persistence unit configuration

The issue with RESOURCE_LOCAL units is that it is used a bit differently if you are in a EE container or not. Basically in a container the spec mandates the unit type to be JTA is you don’t specify any datasource (jta and non jta one)…even if you set RESOURCE_LOCAL.

Issue is: in standalone mode you never do it so if you import a standalone app then it is broken.

That’s why TomEE added two configurable properties (system properties or unit properties).

The first one is:

openejb.force-unit-type = false # by default it is true

This boolean just configure if you respect this part of the specification (JPA 2.0) or not – of course by default it does.

The second one is:

openejb.guess.resource-local-datasource-properties-configured = true # by default

This other boolean checks in unit properties if you configured a datasource with javax.persistence.jdbc.* properties and if yes then it skips the auto configuration TomEE does on non-jta-datasource. Of course if you don’t activate previous one this one is skipped but if you activate previous one this one is active by default.

This makes integration of not EE persistence units really easier once activated (in particular when you can’t repackage the application ;)).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s