Yes, that is true. But the limitation is that this still needs to run within 
the context of a Spring platform tx manager, as all the code written is 
Spring-specific. In other words, I do not think that it is possible to use 
things your way.
 
If you want to use Castor JDO and plain JDBC from 'within' Spring, please 
consider using the JDBCTemplate classes, as this is designed for exectly this 
need, i.e. to span transactions across multiple datasources.
 
Regards
Werner


________________________________

        From: Sébastien PERES-LABOURDETTE - Public [mailto:[EMAIL PROTECTED] 
        Sent: Freitag, 23. Februar 2007 11:48
        To: Castor User
        Subject: [castor-user] CastorTransactionManager
        
        
        Hi.
        
        Performance issues leads me to mix jdo with some plain jdbc code.
        For that reason, i wish to use the spring orm implementation for castor.
        
        I wrote a method  :
        
            public DataSource getDbDs(String dbId) {
                CastorTransactionManager ctm = new 
CastorTransactionManager(_jdoMap.get(dbId));
                return ctm.getDataSource();
            }
        
        _jdoMap being a map of JDOManagers successfully initialized.
        
        Each JDOManager points to a database conf that maps a data-source such :
        
                <data-source 
class-name="org.apache.commons.dbcp.BasicDataSource">
                    <param name="driver-class-name" 
value="com.informix.jdbc.IfxDriver" />
                    <param name="username" value="informix" />
                    <param name="password" value="informix" />
                    <param name="url" value="jdbc:informix-sqli://url" />
                    <param name="maxActive" value="10" />
                    <param name="initialSize" value="3" />
                    <param name="removeAbandoned" value="true" />
                </data-source>        
        
        But the "getDbDs" method returns null anyway.
        
        Any issue ?
        
        
        NB :
        The javadoc for "CastorTransactionManager" specifies this : 
        
        "With a CastorDialect specified, this implementation also supports 
direct DataSource access within a transaction (i.e. plain JDBC code working 
with the same DataSource). This allows for mixing services that access Castor 
JDO (including transactional caching) and services that use plain JDBC (without 
being aware of Castor JDO)! Application code needs to stick to the same simple 
Connection lookup pattern as with DataSourceTransactionManager (i.e. 
DataSourceUtils.getConnection)."
        
        
        
        
        -- 
        Sébastien PERES-LABOURDETTE

Reply via email to