You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by jm...@chubb.com on 2005/05/19 23:00:08 UTC

Integration with Spring --> development effort started

Hello,

My name is John Menke.  A long time back i contributed some documentation
to the Torque project (torque 2).

Recently, I have started a development effort to integrate Torque with the
Spring Framework.

On advice from Rod Johnson i have been following a simple plan:
                                                                            
                                                                            
   <advice on how to implement ORM support in Spring>                       
   The basic concepts you'd want to consider are resource acquisition and   
   release, error handling, and transaction management. The Spring code is  
   of course the best place to look.                                        
                                                                            
   You would probably implement the following artifacts:                    
                                                                            
   - Template (like JdbcTemplate or HibernateTemplate)                      
   - Exception translator to map from ORM exceptions into                   
   DataAccessException hierarchy                                            
   - DaoSupport class, like JdbcDaoSupport, that provides a convenient      
   (optional) superclass for implementing user DAOs                         
   - Session factory implementation, like LocalSessionFactoryBean           
                                                                            
   You could also look at the chapter on data access inJ2EE without EJB,    
   which explains the concepts.                                             
                                                                            
   Rgds                                                                     
   Rod[/list]                                                               
   </advice on how to implement ORM support in Spring>                      
                                                                            
                                                                            
    I have started work on the above and posted this message to the Spring  
    Developer List and Spring DAO forum.                                    
                                                                            
    If someone from the torque development would be interested in guiding   
    me I think I will have a better chance of getting this done.  Any       
    takers?                                                                 
                                                                            
    <post to spring-dev>                                                    
                                                                            
    Following the pattern of what is out there already i have created       
    stubbed out classes for 2 packages:                                     
                                                                            
    org.springframework.orm.torque                                          
    -TorqueAccessor                                                         
    -TorqueCallback                                                         
    -TorqueOperations                                                       
    -TorqueJDBCException                                                    
    -TorqueTemplate                                                         
    org.springframework.orm.torque.support                                  
    -TorqueDaoSupport                                                       
                                                                            
    Following the current design patterns in the other Spring ORM           
    implementations, i coded the TorqueOperations interface. The methods    
    defined in it are the methods that Torque makes available to it's       
    persistence classes defined in org.apache.torque.util.BasePeer.         
                                                                            
    In the template i plan to delegate the calls into template methods to   
    a BasePeer object (POJO with all static methods).                       
                                                                            
    Something like this:                                                    
                                                                            
    Code:                                                                   
    public List doSelect(org.apache.torque.util.Criteria criteria)          
    throws DataAccessException {                                            
                                                                            
    List returnList = null;                                                 
                                                                            
    try {                                                                   
    returnList = this.getTorqueBasePeer().doSelect(criteria);               
    } catch (TorqueException e) {                                           
    convertTorqueAccessException(e);                                        
    }                                                                       
                                                                            
    return returnList;                                                      
    }                                                                       
                                                                            
    Is this a correct approach? Is there any place i can share this code    
    with others that are interested?                                        
                                                                            
    -jm                                                                     
                                                                            
    <post to spring-dev>                                                    
                                                                            
    Thanks in advance for any help.                                         
                                                                            
    JM                                                                      
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            






John Menke

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Re: Integration with Spring --> development effort started

Posted by jm...@chubb.com.
Thomas,

thanks for your reply.  I will post another message to the users list.  The
response from the
Spring list has been slow also,  but i think i have a good start at least.
The basic idea of Springs' ORM support is to create a wrapper around the
ORM tool.  This enables you to have the Spring wrapper classes throw
exceptions that are common between different ORM tools.  It also enables
you to have a common method of performing transactions across ORM
frameworks.  I still have alot of testing to do as the code is only stubbed
out at the moment.  I will keep you posted as to my progress.


John Menke

Thomas Fischer <tf...@apache.org> wrote on 05/22/2005 04:29:54 AM:

> Hi,
>
> I have never worked with Spring so I am probably the wrong person to ask
> about this. I am also sorry to say that, although I would like to learn
> something about Spring, I simply have not got the time at the moment.
> Maybe there will be better times.
>
> This does NOT mean that I am not willing to help you in your effort, but
> my comments will not be very Spring aware. Simply post any questions you
> got to the Torque users list (maybe this will also attract more
> people who are interested to use Torque with Spring)
>
> Please keep us informed about your progress
>
>            Thomas
>
> On Thu, 19 May 2005 jmenke@chubb.com wrote:
>
> > Hello,
> >
> > My name is John Menke.  A long time back i contributed some
documentation
> > to the Torque project (torque 2).
> >
> > Recently, I have started a development effort to integrate Torque with
the
> > Spring Framework.
> >
> > On advice from Rod Johnson i have been following a simple plan:
> >
> >
> >   <advice on how to implement ORM support in Spring>
> >   The basic concepts you'd want to consider are resource acquisition
and
> >   release, error handling, and transaction management. The Spring code
is
> >   of course the best place to look.
> >
> >   You would probably implement the following artifacts:
> >
> >   - Template (like JdbcTemplate or HibernateTemplate)
> >   - Exception translator to map from ORM exceptions into
> >   DataAccessException hierarchy
> >   - DaoSupport class, like JdbcDaoSupport, that provides a convenient
> >   (optional) superclass for implementing user DAOs
> >   - Session factory implementation, like LocalSessionFactoryBean
> >
> >   You could also look at the chapter on data access inJ2EE without EJB,
> >   which explains the concepts.
> >
> >   Rgds
> >   Rod[/list]
> >   </advice on how to implement ORM support in Spring>
> >
> >
> >    I have started work on the above and posted this message to the
Spring
> >    Developer List and Spring DAO forum.
> >
> >    If someone from the torque development would be interested in
guiding
> >    me I think I will have a better chance of getting this done.  Any
> >    takers?
> >
> >    <post to spring-dev>
> >
> >    Following the pattern of what is out there already i have created
> >    stubbed out classes for 2 packages:
> >
> >    org.springframework.orm.torque
> >    -TorqueAccessor
> >    -TorqueCallback
> >    -TorqueOperations
> >    -TorqueJDBCException
> >    -TorqueTemplate
> >    org.springframework.orm.torque.support
> >    -TorqueDaoSupport
> >
> >    Following the current design patterns in the other Spring ORM
> >    implementations, i coded the TorqueOperations interface. The methods
> >    defined in it are the methods that Torque makes available to it's
> >    persistence classes defined in org.apache.torque.util.BasePeer.
> >
> >    In the template i plan to delegate the calls into template methods
to
> >    a BasePeer object (POJO with all static methods).
> >
> >    Something like this:
> >
> >    Code:
> >    public List doSelect(org.apache.torque.util.Criteria criteria)
> >    throws DataAccessException {
> >
> >    List returnList = null;
> >
> >    try {
> >    returnList = this.getTorqueBasePeer().doSelect(criteria);
> >    } catch (TorqueException e) {
> >    convertTorqueAccessException(e);
> >    }
> >
> >    return returnList;
> >    }
> >
> >    Is this a correct approach? Is there any place i can share this code
> >    with others that are interested?
> >
> >    -jm
> >
> >    <post to spring-dev>
> >
> >    Thanks in advance for any help.
> >
> >    JM
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > John Menke
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-dev-help@db.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Re: Integration with Spring --> development effort started

Posted by Thomas Fischer <tf...@apache.org>.
Hi,

I have never worked with Spring so I am probably the wrong person to ask 
about this. I am also sorry to say that, although I would like to learn 
something about Spring, I simply have not got the time at the moment. 
Maybe there will be better times.

This does NOT mean that I am not willing to help you in your effort, but 
my comments will not be very Spring aware. Simply post any questions you 
got to the Torque users list (maybe this will also attract more
people who are interested to use Torque with Spring)

Please keep us informed about your progress

           Thomas

On Thu, 19 May 2005 jmenke@chubb.com wrote:

> Hello,
>
> My name is John Menke.  A long time back i contributed some documentation
> to the Torque project (torque 2).
>
> Recently, I have started a development effort to integrate Torque with the
> Spring Framework.
>
> On advice from Rod Johnson i have been following a simple plan:
>
>
>   <advice on how to implement ORM support in Spring>
>   The basic concepts you'd want to consider are resource acquisition and
>   release, error handling, and transaction management. The Spring code is
>   of course the best place to look.
>
>   You would probably implement the following artifacts:
>
>   - Template (like JdbcTemplate or HibernateTemplate)
>   - Exception translator to map from ORM exceptions into
>   DataAccessException hierarchy
>   - DaoSupport class, like JdbcDaoSupport, that provides a convenient
>   (optional) superclass for implementing user DAOs
>   - Session factory implementation, like LocalSessionFactoryBean
>
>   You could also look at the chapter on data access inJ2EE without EJB,
>   which explains the concepts.
>
>   Rgds
>   Rod[/list]
>   </advice on how to implement ORM support in Spring>
>
>
>    I have started work on the above and posted this message to the Spring
>    Developer List and Spring DAO forum.
>
>    If someone from the torque development would be interested in guiding
>    me I think I will have a better chance of getting this done.  Any
>    takers?
>
>    <post to spring-dev>
>
>    Following the pattern of what is out there already i have created
>    stubbed out classes for 2 packages:
>
>    org.springframework.orm.torque
>    -TorqueAccessor
>    -TorqueCallback
>    -TorqueOperations
>    -TorqueJDBCException
>    -TorqueTemplate
>    org.springframework.orm.torque.support
>    -TorqueDaoSupport
>
>    Following the current design patterns in the other Spring ORM
>    implementations, i coded the TorqueOperations interface. The methods
>    defined in it are the methods that Torque makes available to it's
>    persistence classes defined in org.apache.torque.util.BasePeer.
>
>    In the template i plan to delegate the calls into template methods to
>    a BasePeer object (POJO with all static methods).
>
>    Something like this:
>
>    Code:
>    public List doSelect(org.apache.torque.util.Criteria criteria)
>    throws DataAccessException {
>
>    List returnList = null;
>
>    try {
>    returnList = this.getTorqueBasePeer().doSelect(criteria);
>    } catch (TorqueException e) {
>    convertTorqueAccessException(e);
>    }
>
>    return returnList;
>    }
>
>    Is this a correct approach? Is there any place i can share this code
>    with others that are interested?
>
>    -jm
>
>    <post to spring-dev>
>
>    Thanks in advance for any help.
>
>    JM
>
>
>
>
>
>
>
>
>
>
>
>
>
> John Menke
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org