You can view the issue detail at the following URL:
<http://nagoya.apache.org/scarab/issues/id/TRQS43>

Type :        Enhancement
Issue Id :    TRQS43
Reported by: Joe McGlynn
             [EMAIL PROTECTED] - ([EMAIL PROTECTED])

Details:

Summary: Should generate J2EE-Style DAO and VO objects
Description: This is an ehancement request that consists of _four_ different (but 
complementary) requests.

1) Torque should have factory methods to construct DB-specific DAO Factories
2) These (generated) DB factories should operate only on Value Objects (ie: data 
Beans), except possibly returning read-only data in a RowSet.  This is very close to 
what a Peer is now.
3) The (generated) ValueObjects should be just simple beans that represent a row in 
the table, ie: a setter and getter for each value.  This is nearly identical to the 
generated BaseXXX objects, except the current BaseXXX objects have a private ref to 
the Peer object.
4) As a build option it should be possible to have the ValueObjects implement the 
DirtyMarker interface (attached)

A common J2EE development pattern is to use a combination of Data Access Objects (DAO) 
and Value Objects (VO) behind a SessionBean facade.

DAO Factorys are created via an abstract factory method to return a DB-specific 
implementation.  DAOs are created from factory methods on these objects:

// returns a concrete DAO factory for Oracle
TorqueDAO myDAO = AbstractTorqueDAO.getFactory(AbstractTorqueDAO.ORACLE);  

// returns a concrete DAO object to manipulate data, ie a Peer
com.foo.UserDAO myUserDAO = myDAO.getUser();

// do a select to retrieve data, a List of User objects
List usersList = myUserDAO.doSelect(someCriteria);

// ...the data is displayed, edited, etc...

// persist any changes in the data
Iterator it = usersList.iterator();
while (it.hasNext()) {
  User theUser = (User) it.next();
  if (theUser.isModified() {
    myUserDAO.doUpdate(theUser);
  }
  else if (theUser.isDeleted() {
    myUserDAO.doDelete(theUser);
  }
  else if (theUser.isNew() {
    myUserDAO.doInsert(theUser);
  }
Status: New
Priority: High
Vote: High
Functional area: Setup


--
To unsubscribe, e-mail:   <mailto:turbine-torque-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-torque-dev-help@;jakarta.apache.org>

Reply via email to