MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Guide de l'utilisateur Page 241

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 256
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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);
}
}
Vue de la page 240
1 2 ... 236 237 238 239 240 241 242 243 244 245 246 ... 255 256

Commentaires sur ces manuels

Pas de commentaire