users@javaee-spec.java.net

[javaee-spec users] [jsr342-experts] Datasources and other resources defined on CDI beans

From: Antonio Goncalves <antonio.goncalves_at_gmail.com>
Date: Fri, 6 Jan 2012 09:04:34 +0100

Hi all,

I just came accross a limitation (bug) of GlassFish : adding
a @DataSourceDefinition on a CDI bean doesn't work in an embedded
environment (
http://www.java.net/forum/topic/glassfish/glassfish/invalid-resource-datasource-embedded-mode).
I had to put it in the EJB to make it work.

Why do I use @DataSourceDefinition on a CDI bean instead of an EJB ?
Because I thought I could use alternatives (i.e. defining several data
sources depending on the environment). But this doesn't work in CDI 1.0 (
https://issues.jboss.org/browse/CDI-53).

Alternatives should work on definitions, don't you think ? In other specs,
are you aware of other kind of definitions (I know that JMS 2.0 will bring
similar features with @JMSConnectionFactoryDefinition and
@JMSDestinationDefinition) ? If yes, we should encourage the spec leads to
use similar behavior.

My 2 cents

-- 
Antonio Goncalves
Software architect and Java Champion
Web site <http://www.antoniogoncalves.org> |
Twitter<http://twitter.com/agoncal>|
Blog <http://feeds.feedburner.com/AntonioGoncalves> |
LinkedIn<http://www.linkedin.com/in/agoncal>| Paris
JUG <http://www.parisjug.org>