tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Datasources....Again! Sorry....
Date Fri, 06 May 2016 18:50:39 GMT
This is not reliable AFAIK.

Resources.xml would work but we dont have yet the resource impl returning a
looked up resource - can be in your webapp:

Public class MyResource {
  Private String name;

  Public void create() {
    Return
SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup(name);
  }
}

Then <Resource id="..." class-name="MyResource"
factory-method="create">name=openejb:Resource/foo</Resource> works.
Le 6 mai 2016 20:42, "tonywestonuk" <tonyw@totspics.com> a écrit :

> Its just what I am used to with tomcat.   A set of global resources are
> defined, and then the one that is required is 'selected' by the context.xml
> choosing a global data resource.
>
> One of the advantages is that it was very easy to change between different
> test environments.... just by change the reference in context.xml,  your
> app
> is now pointing at a different database, without having to update the
> settings at the server level tomee.xml
>
> I think its possible using a public static String to define which id is
> needed, and then have to select. not quite as clean, but at least I can
> change the database looked at by the whole app in one place.
>
> @resource(name=DATABASE_REF)
> DataSource database
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Datasources-Again-Sorry-tp4678367p4678378.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message