Guest User

Untitled

a guest
Apr 21st, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def howToDoItInScala(task: Task) = {
  2.   val id = if (task.id() == 0) {
  3.     //object not stored yet in db
  4.     //store it now
  5.     task.save()
  6.     // retrieve the new database id
  7.     Some(task.id())
  8.   } else {
  9.     // dont change the retVal if object did exist already in db
  10.     task.save()
  11.     None
  12.   }  
  13.   id.map(newFunction)
  14. }
Advertisement
Add Comment
Please, Sign In to add comment