This content has been marked as final.
Show 2 replies
-
1. Re: Dynamic datasource name and resource-ref to it
claudio4j Dec 28, 2018 9:23 AM (in response to simix)1 of 1 people found this helpfulYou can use a variable name on your persistence.xml or web.xml, an example
<jta-data-source>${ks.ds}</jta-data-source>
For this to work you need
1) in the EE subsystem (Web Console -> Configuration -> EE), change the "Spec Descriptor Property Replacement" to true
2) set the property/value in the Properties view (Configuration -> System Properties)
-
2. Re: Dynamic datasource name and resource-ref to it
simix Dec 29, 2018 5:51 AM (in response to claudio4j)So, while I try this recommendation, I have found more fit method for my case - using default datasource binding on the page EE -> default bindigs. Is it JavaEE compliant (specify JNDI of default datasource in container) ?
Datasource will inject with code
@Resource
private DataSource myDatasource
and shutdown order is safe
Thank you