ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Rouillier <guyr-...@burntmail.com>
Subject Re: iBatis 3.0 minimal complete example
Date Thu, 11 Feb 2010 18:40:48 GMT
On 2/10/2010 11:40 PM, Rick R wrote:
> certainly not very.) Feel free to let me know off-list how DI has
> 'really' helped - not some mythical Spinal Tap "Well this one goes to
> 11" argument.

DI has made code simpler in the EJB3 world.  With EJB2, to obtain a JNDI 
datasource, you had to do lookups like this:

connection = ((DataSource) (new 

With EJB3, you simply annotate like this:

@Resource(type = DataSource.class, mappedName = "java:troubleticketDB")
    private DataSource          ds;

    connection = ds.getConnection();

Much more logical to work with.  And because you are no longer doing 
lookups, you don't have to catch NamingExceptions throughout your code.

Syntactic sugar perhaps, but sweet.

Guy Rouillier

To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org

View raw message