Guest User

how to do it in scala

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