Created
February 10, 2015 12:54
-
-
Save MinCha/59e001fbffb5e916e52c to your computer and use it in GitHub Desktop.
My Function Class #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component class InTransaction { | |
@Transactional def execute[T](f: => T): T = f | |
} | |
object InTransaction { | |
def apply[T](f: => T): T = Global.ctx.getBean(classOf[InTransaction]).execute(f) | |
} | |
def findListByUserMatching(): EssentialAction = UserAction { user => | |
request => | |
InTransaction { | |
val popularQuestion = questionService.findPopularQuestion.get | |
val result = questionService.findListByUserMatching(user).map(new MatchQuestionListView(_)) | |
success(result, new PopularQuestionView(popularQuestion)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment