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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
