Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@marcpalmer
Created November 12, 2012 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcpalmer/4058935 to your computer and use it in GitHub Desktop.
Save marcpalmer/4058935 to your computer and use it in GitHub Desktop.
Hibernate optimist locking code snippet #6
// Transactional service method
void addComment(Photo photo, String text) {
def comment = new PhotoComment(text: text)
comment.save()
photo.addToComments(comment)
}
// Asynchronous Quartz Job method
void uploadPhoto(Photo p) {
// do something with S3
// …
photo.url = newUrl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment