I was looking at tutorial 2, and looking at how to update an item in the DB.

The question I have is if I have the code below:

public void updateHome( HomeBO home ) throws DataAccessException
{
Transaction tx = odmg.newTransaction();
try
{
tx.begin();
tx.lock( home , tx.WRITE );
tx.commit();
}
catch( Exception e )
{
tx.abort();
if( log.isFatalEnabled() )
log.fatal( "An exception occured during database processing" , e );
}
}

I would think that since HomeBO contains all the information that I want to update that I can pass it directly to the tx.lock() for updating. It even contains the home.getHomeID() which is the primary key and defined in the repository as such. Am I mistaken here or do I still need to do the Select of the item to be udpate, do all the sets Then do the commit? If so, that's a bummer because having to do all that is almost just as much as writing my own sql :-\

Hopefully I'm missing a piece.

R


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to