d.lo...@uib.es wrote: > Hi Scott, > > Thanks for the pointer. I managed to get it to work, more or less, > using the new way: > -- > <leaf:ConnectionPoolDataSource> > ... > </leaf:ConnectionPoolDataSource> > -- > and the old "bean" way: > -- > <bean name="MyPool"> > <type>org.leaf.ConnectionPoolDataSource</type> > <jndi-name>java:comp/env/jdbc/MyPool</jndi-name> > <init> > ... > </init> > </bean> > -- > > However, I find it more flexible to use the old bean way as it allows > me to publish it to JNDI, so the old JNDI-based applications don't > have to rewritten, and it allows me more easily to instantiate > different resources and assign them different names (If I understoon > correctly, I have to create a new @Qualified annotation for each name > with the new Resin 4.0's way). > Well, I've just added a resin:Jndi="java:comp/env/jdbc/MyPool" to achieve the same thing as the old one.
With the new Qualifiers, it's recommended to have a Qualifier for each kind of resource. You can use the annotation's attributes to distinguish between similar qualifiers. So you could have @Login(xa=false) vs @Login(xa=true) to distinguish a transactional DataSource from a non-transactional one. Also, you can use the built-in @Named("MyPool") as a general Qualifier. It's recommended to use custom ones to improve the code's documentation, but the @Named works perfectly well. Unless you have a specific need for JNDI or have legacy code or are transitioning, I see less need in the future for JNDI. It's more cumbersome, and provides less code self-documentation than CDI injection. -- Scott > Am I missing something? I like much better the old way :). > D. > > > S'està citant Scott Ferguson <f...@caucho.com>: > > >> Daniel López wrote: >> >>> Hi there, >>> >>> For some reason, I would like to be able inside Resin a datasource >>> implementation other than Resin's, C3P0 for example, and I have been >>> unable to find in the documentation how would one configure it. The >>> examples that I found use the <database> tag, which does not seem to >>> have an attribute to specify an implementation class for the DataSource. >>> >>> Is it possible at all? >>> >>> >> You'd treat it as a generic bean. In Resin 4.0.x, it would be the >> >> <c3p0:DataSourceImpl xmlns:c3p0="..."> >> ... >> </c3p0:DataSourceImpl> >> >> The <database> tag wouldn't make sense, because it's integrated with >> Resin's JCA/pooling code, which is what you're trying to replace. >> >> -- Scott >> >>> D. >>> > > > ---------------------------------------------------------------- > > > > > > _______________________________________________ > resin-interest mailing list > firstname.lastname@example.org > http://maillist.caucho.com/mailman/listinfo/resin-interest > > _______________________________________________ resin-interest mailing list email@example.com http://maillist.caucho.com/mailman/listinfo/resin-interest