tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <>
Subject Re: Any way to define custom properties in a datasource definition that can be read by the application?
Date Sat, 14 Jan 2017 09:48:19 GMT

I would recommand you to not touch too much datasources but you can create
a DataSourceConfig as resource and inject the properties you want. If you
don't want a custom type (DataSourceConfig) use:

<Resource id="config" class-name="org.apache.openejb.config.sys.MapFactory"

and @Resource(name="config") Properties props;

Side note: properties are synchronized so maybe wrap it in a plain HashMap
for runtime perf (use @PostConstruct).

Le 14 janv. 2017 00:57, "KARR, DAVID" <> a écrit :

My problem may just be a SQL issue, but let me describe the whole problem.

I've written a small back-end service that runs an Oracle query (using
Spring JDBC).  I built it first with a particular datasource in mind, but I
knew I would be changing to another datasource, and also to make it use
multiple similarly-formatted datasources.  I was told that they would all
have the same schema, so I wasn't that concerned (dumb).

Using the original datasource, I could run a query like "select
variouscolumns from TABLE_NAME ...".  I'm now about to integrate the second
datasource, but in this datasource, I have to do "select variouscolumns
from BLAH.TABLE_NAME ..." (what is the Oracle SQL term for what "BLAH"

I have to design a strategy will let me use basically the same query on
both datasources (and others).  The best idea I can come up with is
defining environment strings associated with each datasource that
represents the "table prefix" (still don't know what that term is).  This
can work, but it's a little annoying.  Is there some way I could define a
custom property in each datasource Resource defined in "tomee.xml" and have
that readable by the application?

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