Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def howToDoItInScala(task: Task) = {
- val id = if (task.id() == 0) {
- //object not stored yet in db
- //store it now
- task.save()
- // retrieve the new database id
- Some(task.id())
- } else {
- // dont change the retVal if object did exist already in db
- task.save()
- None
- }
- id.map(newFunction)
- }
Advertisement
Add Comment
Please, Sign In to add comment