Your SlideShare is downloading. ×
0
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
JDO
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

JDO

534

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
534
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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)

×