Advertisement

JDO

Programmer at New Cast Co LTD
Aug. 3, 2009
Advertisement

More Related Content

Advertisement
Advertisement

JDO

  1. def jdoTemplate def transactionTemplate def save = { transactionTemplate.execute( { status -> def album = new Album(params) if(!album.hasErrors() && album.validate() ) { jdoTemplate.makePersist(album) flash.message = "Album ${albumInstance.id} created" redirect(action:show,id:album.id) } else { status.setRollbackOnly() render(view:'create',model:[album:album]) } } as TransactionCallback ) }
  2. Transient Persistent-new Persistent-dirty Hollow Persistent-clean Persistent-deleted Persistent-new-deleted
  3. http://java.sun.com/developer/technicalArticles/J2SE/jdo/fig2sm.gif
  4. http://db.apache.org/jdo/images/state_transition_persist.gif
  5. http://db.apache.org/jdo/images/state_transition_update.gif
  6. http://db.apache.org/jdo/images/state_transition_delete.gif
  7. @PersistenceCapable(...) @PersistenceCapable(...) class Parent class Child implements Serializable { implements Serializable{ @PrimaryKey @PrimaryKey @Persistent(...) @Persistent(...) Long id Key key @Persistent ... Child child } ... }
  8. @PersistenceCapable(...) @PersistenceCapable(...) class Parent class Child implements Serializable { implements Serializable{ @PrimaryKey @PrimaryKey @Persistent(...) @Persistent(...) Long id Key key @Persistent @Persistent(mappedBy='child') Child child Parent parent ... ... } }
  9. @PersistenceCapable(...) @PersistenceCapable(...) class Parent class Child implements Serializable { implements Serializable{ @PrimaryKey @PrimaryKey @Persistent(...) @Persistent(...) Long id Key key @Persistent ... List<Child> children } ... }
  10. @PersistenceCapable(...) @PersistenceCapable(...) class Parent class Child implements Serializable { implements Serializable{ @PrimaryKey @PrimaryKey @Persistent(...) @Persistent(...) Long id Key key @Persistent(mappedBy='parent') @Persistent List<Child> children Parent parent ... ... } }
  11. @PersistenceCapable(...) @PersistenceCapable(...) class A class B implements Serializable { implements Serializable { @PrimaryKey @PrimaryKey @Persistent(...) @Persistent(...) Key key Key key @Persistent @Persistent Set<key> bKeys Set<Key> aKeys ... ... } } def a = persistenceManager.getObjectById(...) def bList = persistenceManager.getObjectsById(a.bKeys)
Advertisement