Title: RE: [castor-dev] Is it really better to do business in object way?

I never said in computer that one way to do is better than another.

But if you do in the "object way" you abstract the database. Your code never show a table name or something like that, so if anybody do a change in your database, you only have to change the mappings.xml.

Or, if you like to use one program in different projects, with diferent database estructure, it could be easier in the "object way".

HTH.

Regards, Enrique.

-----Mensaje original-----
De: SeaCat [mailto:[EMAIL PROTECTED]]
Enviado el: lunes, 30 de septiembre de 2002 13:37
Para: [EMAIL PROTECTED]
Asunto: [castor-dev] Is it really better to do business in object way?



Why do we code like this:

oql = db.getOQLQuery( "SELECT p FROM Product p WHERE Group=$" );
oql.bind( groupId );

results = oql.execute();
while ( results.hasMore() ) {
  Product prod; 
  prod = (Product) results.next();
  if( prod.getStockCount()>=10){
    prod.markDown( 0.25 );
    prod.setOnSale( true );
  }
}

if we can just execute the following SQL in JDBC:

update product p set p.on_sale = 1
where p.stock_count >=10

?

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev


Reply via email to