MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Guida Utente Pagina 241

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 256
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 240
Build a distributed application with the Java adapter 241
The following example shows the assembler classs doCreate(), doUpdate(), and
doDelete() methods:
private ChangeObject doCreate(ChangeObject co)
{
ContactDAO dao = new ContactDAO();
Contact contact = dao.create((Contact) co.getNewVersion());
co.setNewVersion(contact);
return co;
}
private void doUpdate(ChangeObject co)
{
ContactDAO dao = new ContactDAO();
try
{
dao.update((Contact) co.getNewVersion(), (Contact)
co.getPreviousVersion());
}
catch (ConcurrencyException e)
{
System.err.println("*** Throwing DataSyncException when trying to
update contact id=" + ((Contact) co.getNewVersion()).getContactId() );
throw new DataSyncException(co);
}
}
private void doDelete(ChangeObject co)
{
ContactDAO dao = new ContactDAO();
try
{
dao.delete((Contact) co.getPreviousVersion());
}
catch (ConcurrencyException e)
{
System.err.println("*** Throwing DataSyncException when trying to
delete contact id=" + ((Contact) co.getNewVersion()).getContactId() );
throw new DataSyncException(co);
}
}
Vedere la pagina 240
1 2 ... 236 237 238 239 240 241 242 243 244 245 246 ... 255 256

Commenti su questo manuale

Nessun commento