{"action":"created","comment":{"url":"https://api.github.com/repos/fib0n/Orm/pulls/comments/24777572","id":24777572,"diff_hunk":"@@ -0,0 +1,28 @@\n+package hh.homework.transactionexample.players;\n+\n+import hh.homework.transactionexample.common.EntityDAO;\n+\n+import javax.inject.Inject;\n+import java.util.Optional;\n+\n+import static com.google.common.base.Preconditions.checkNotNull;\n+\n+/**\n+ * Created by fib on 04/01/15.\n+ */\n+public class PlayerService {\n+    private final EntityDAO<Player> playerDAO;\n+\n+    @Inject\n+    public PlayerService(final EntityDAO<Player> playerDAO) {\n+        this.playerDAO = checkNotNull(playerDAO);\n+    }\n+\n+    public Optional<Player> get(final int id) {\n+        return playerDAO.get(id);\n+    }\n+\n+    public void changeClub(final Player player, final int clubId) {\n+        playerDAO.addOrUpdate(player.withClub(clubId));\n+    }\n+}","path":"src/main/java/hh/homework/transactionexample/players/PlayerService.java","position":null,"original_position":28,"commit_id":"cc8dae0453d5edf86edf1334be6fb4444c4165f4","original_commit_id":"40e9f31dc99dc520811211fef1d3fec3ec1eda99","user":{"login":"fib0n","id":1004387,"avatar_url":"https://avatars.githubusercontent.com/u/1004387?v=3","gravatar_id":"","url":"https://api.github.com/users/fib0n","html_url":"https://github.com/fib0n","followers_url":"https://api.github.com/users/fib0n/followers","following_url":"https://api.github.com/users/fib0n/following{/other_user}","gists_url":"https://api.github.com/users/fib0n/gists{/gist_id}","starred_url":"https://api.github.com/users/fib0n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fib0n/subscriptions","organizations_url":"https://api.github.com/users/fib0n/orgs","repos_url":"https://api.github.com/users/fib0n/repos","events_url":"https://api.github.com/users/fib0n/events{/privacy}","received_events_url":"https://api.github.com/users/fib0n/received_events","type":"User","site_admin":false},"body":"Я рассуждал так: playerService ничего не знает о clubService и работает только с одним playerDAO, поэтому и транзакции ему не нужны. ClubService же работает и с clubDAO и с playerService, поэтому он и будет транзакциями управлять. В общем, для моего конкретного примера с продажей клубом игрока  в  playerService добавление транзакций посчитал излишним, ну и плюс доп защита от всяких ненужных nested transactions not supported exception и т.д.","created_at":"2015-02-16T21:38:52Z","updated_at":"2015-02-16T21:38:52Z","html_url":"https://github.com/fib0n/Orm/pull/1#discussion_r24777572","pull_request_url":"https://api.github.com/repos/fib0n/Orm/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/fib0n/Orm/pulls/comments/24777572"},"html":{"href":"https://github.com/fib0n/Orm/pull/1#discussion_r24777572"},"pull_request":{"href":"https://api.github.com/repos/fib0n/Orm/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/fib0n/Orm/pulls/1","id":26794948,"html_url":"https://github.com/fib0n/Orm/pull/1","diff_url":"https://github.com/fib0n/Orm/pull/1.diff","patch_url":"https://github.com/fib0n/Orm/pull/1.patch","issue_url":"https://api.github.com/repos/fib0n/Orm/issues/1","number":1,"state":"open","locked":false,"title":"transaction example","user":{"login":"fib0n","id":1004387,"avatar_url":"https://avatars.githubusercontent.com/u/1004387?v=3","gravatar_id":"","url":"https://api.github.com/users/fib0n","html_url":"https://github.com/fib0n","followers_url":"https://api.github.com/users/fib0n/followers","following_url":"https://api.github.com/users/fib0n/following{/other_user}","gists_url":"https://api.github.com/users/fib0n/gists{/gist_id}","starred_url":"https://api.github.com/users/fib0n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fib0n/subscriptions","organizations_url":"https://api.github.com/users/fib0n/orgs","repos_url":"https://api.github.com/users/fib0n/repos","events_url":"https://api.github.com/users/fib0n/events{/privacy}","received_events_url":"https://api.github.com/users/fib0n/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-04T13:05:48Z","updated_at":"2015-02-16T21:38:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6301c223ce0dc4fc0c0a97663d7354b8a4df60da","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fib0n/Orm/pulls/1/commits","review_comments_url":"https://api.github.com/repos/fib0n/Orm/pulls/1/comments","review_comment_url":"https://api.github.com/repos/fib0n/Orm/pulls/comments/{number}","comments_url":"https://api.github.com/repos/fib0n/Orm/issues/1/comments","statuses_url":"https://api.github.com/repos/fib0n/Orm/statuses/cc8dae0453d5edf86edf1334be6fb4444c4165f4","head":{"label":"fib0n:dev","ref":"dev","sha":"cc8dae0453d5edf86edf1334be6fb4444c4165f4","user":{"login":"fib0n","id":1004387,"avatar_url":"https://avatars.githubusercontent.com/u/1004387?v=3","gravatar_id":"","url":"https://api.github.com/users/fib0n","html_url":"https://github.com/fib0n","followers_url":"https://api.github.com/users/fib0n/followers","following_url":"https://api.github.com/users/fib0n/following{/other_user}","gists_url":"https://api.github.com/users/fib0n/gists{/gist_id}","starred_url":"https://api.github.com/users/fib0n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fib0n/subscriptions","organizations_url":"https://api.github.com/users/fib0n/orgs","repos_url":"https://api.github.com/users/fib0n/repos","events_url":"https://api.github.com/users/fib0n/events{/privacy}","received_events_url":"https://api.github.com/users/fib0n/received_events","type":"User","site_admin":false},"repo":{"id":28774320,"name":"Orm","full_name":"fib0n/Orm","owner":{"login":"fib0n","id":1004387,"avatar_url":"https://avatars.githubusercontent.com/u/1004387?v=3","gravatar_id":"","url":"https://api.github.com/users/fib0n","html_url":"https://github.com/fib0n","followers_url":"https://api.github.com/users/fib0n/followers","following_url":"https://api.github.com/users/fib0n/following{/other_user}","gists_url":"https://api.github.com/users/fib0n/gists{/gist_id}","starred_url":"https://api.github.com/users/fib0n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fib0n/subscriptions","organizations_url":"https://api.github.com/users/fib0n/orgs","repos_url":"https://api.github.com/users/fib0n/repos","events_url":"https://api.github.com/users/fib0n/events{/privacy}","received_events_url":"https://api.github.com/users/fib0n/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fib0n/Orm","description":null,"fork":false,"url":"https://api.github.com/repos/fib0n/Orm","forks_url":"https://api.github.com/repos/fib0n/Orm/forks","keys_url":"https://api.github.com/repos/fib0n/Orm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fib0n/Orm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fib0n/Orm/teams","hooks_url":"https://api.github.com/repos/fib0n/Orm/hooks","issue_events_url":"https://api.github.com/repos/fib0n/Orm/issues/events{/number}","events_url":"https://api.github.com/repos/fib0n/Orm/events","assignees_url":"https://api.github.com/repos/fib0n/Orm/assignees{/user}","branches_url":"https://api.github.com/repos/fib0n/Orm/branches{/branch}","tags_url":"https://api.github.com/repos/fib0n/Orm/tags","blobs_url":"https://api.github.com/repos/fib0n/Orm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fib0n/Orm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fib0n/Orm/git/refs{/sha}","trees_url":"https://api.github.com/repos/fib0n/Orm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fib0n/Orm/statuses/{sha}","languages_url":"https://api.github.com/repos/fib0n/Orm/languages","stargazers_url":"https://api.github.com/repos/fib0n/Orm/stargazers","contributors_url":"https://api.github.com/repos/fib0n/Orm/contributors","subscribers_url":"https://api.github.com/repos/fib0n/Orm/subscribers","subscription_url":"https://api.github.com/repos/fib0n/Orm/subscription","commits_url":"https://api.github.com/repos/fib0n/Orm/commits{/sha}","git_commits_url":"https://api.github.com/repos/fib0n/Orm/git/commits{/sha}","comments_url":"https://api.github.com/repos/fib0n/Orm/comments{/number}","issue_comment_url":"https://api.github.com/repos/fib0n/Orm/issues/comments/{number}","contents_url":"https://api.github.com/repos/fib0n/Orm/contents/{+path}","compare_url":"https://api.github.com/repos/fib0n/Orm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fib0n/Orm/merges","archive_url":"https://api.github.com/repos/fib0n/Orm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fib0n/Orm/downloads","issues_url":"https://api.github.com/repos/fib0n/Orm/issues{/number}","pulls_url":"https://api.github.com/repos/fib0n/Orm/pulls{/number}","milestones_url":"https://api.github.com/repos/fib0n/Orm/milestones{/number}","notifications_url":"https://api.github.com/repos/fib0n/Orm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fib0n/Orm/labels{/name}","releases_url":"https://api.github.com/repos/fib0n/Orm/releases{/id}","created_at":"2015-01-04T13:02:19Z","updated_at":"2015-02-16T21:23:12Z","pushed_at":"2015-02-16T21:23:11Z","git_url":"git://github.com/fib0n/Orm.git","ssh_url":"git@github.com:fib0n/Orm.git","clone_url":"https://github.com/fib0n/Orm.git","svn_url":"https://github.com/fib0n/Orm","homepage":null,"size":208,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"dev"}},"base":{"label":"fib0n:master","ref":"master","sha":"6d244b8c624bfc4acdbed6a6e8c44cd97072f2c2","user":{"login":"fib0n","id":1004387,"avatar_url":"https://avatars.githubusercontent.com/u/1004387?v=3","gravatar_id":"","url":"https://api.github.com/users/fib0n","html_url":"https://github.com/fib0n","followers_url":"https://api.github.com/users/fib0n/followers","following_url":"https://api.github.com/users/fib0n/following{/other_user}","gists_url":"https://api.github.com/users/fib0n/gists{/gist_id}","starred_url":"https://api.github.com/users/fib0n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fib0n/subscriptions","organizations_url":"https://api.github.com/users/fib0n/orgs","repos_url":"https://api.github.com/users/fib0n/repos","events_url":"https://api.github.com/users/fib0n/events{/privacy}","received_events_url":"https://api.github.com/users/fib0n/received_events","type":"User","site_admin":false},"repo":{"id":28774320,"name":"Orm","full_name":"fib0n/Orm","owner":{"login":"fib0n","id":1004387,"avatar_url":"https://avatars.githubusercontent.com/u/1004387?v=3","gravatar_id":"","url":"https://api.github.com/users/fib0n","html_url":"https://github.com/fib0n","followers_url":"https://api.github.com/users/fib0n/followers","following_url":"https://api.github.com/users/fib0n/following{/other_user}","gists_url":"https://api.github.com/users/fib0n/gists{/gist_id}","starred_url":"https://api.github.com/users/fib0n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fib0n/subscriptions","organizations_url":"https://api.github.com/users/fib0n/orgs","repos_url":"https://api.github.com/users/fib0n/repos","events_url":"https://api.github.com/users/fib0n/events{/privacy}","received_events_url":"https://api.github.com/users/fib0n/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fib0n/Orm","description":null,"fork":false,"url":"https://api.github.com/repos/fib0n/Orm","forks_url":"https://api.github.com/repos/fib0n/Orm/forks","keys_url":"https://api.github.com/repos/fib0n/Orm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fib0n/Orm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fib0n/Orm/teams","hooks_url":"https://api.github.com/repos/fib0n/Orm/hooks","issue_events_url":"https://api.github.com/repos/fib0n/Orm/issues/events{/number}","events_url":"https://api.github.com/repos/fib0n/Orm/events","assignees_url":"https://api.github.com/repos/fib0n/Orm/assignees{/user}","branches_url":"https://api.github.com/repos/fib0n/Orm/branches{/branch}","tags_url":"https://api.github.com/repos/fib0n/Orm/tags","blobs_url":"https://api.github.com/repos/fib0n/Orm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fib0n/Orm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fib0n/Orm/git/refs{/sha}","trees_url":"https://api.github.com/repos/fib0n/Orm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fib0n/Orm/statuses/{sha}","languages_url":"https://api.github.com/repos/fib0n/Orm/languages","stargazers_url":"https://api.github.com/repos/fib0n/Orm/stargazers","contributors_url":"https://api.github.com/repos/fib0n/Orm/contributors","subscribers_url":"https://api.github.com/repos/fib0n/Orm/subscribers","subscription_url":"https://api.github.com/repos/fib0n/Orm/subscription","commits_url":"https://api.github.com/repos/fib0n/Orm/commits{/sha}","git_commits_url":"https://api.github.com/repos/fib0n/Orm/git/commits{/sha}","comments_url":"https://api.github.com/repos/fib0n/Orm/comments{/number}","issue_comment_url":"https://api.github.com/repos/fib0n/Orm/issues/comments/{number}","contents_url":"https://api.github.com/repos/fib0n/Orm/contents/{+path}","compare_url":"https://api.github.com/repos/fib0n/Orm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fib0n/Orm/merges","archive_url":"https://api.github.com/repos/fib0n/Orm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fib0n/Orm/downloads","issues_url":"https://api.github.com/repos/fib0n/Orm/issues{/number}","pulls_url":"https://api.github.com/repos/fib0n/Orm/pulls{/number}","milestones_url":"https://api.github.com/repos/fib0n/Orm/milestones{/number}","notifications_url":"https://api.github.com/repos/fib0n/Orm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fib0n/Orm/labels{/name}","releases_url":"https://api.github.com/repos/fib0n/Orm/releases{/id}","created_at":"2015-01-04T13:02:19Z","updated_at":"2015-02-16T21:23:12Z","pushed_at":"2015-02-16T21:23:11Z","git_url":"git://github.com/fib0n/Orm.git","ssh_url":"git@github.com:fib0n/Orm.git","clone_url":"https://github.com/fib0n/Orm.git","svn_url":"https://github.com/fib0n/Orm","homepage":null,"size":208,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/fib0n/Orm/pulls/1"},"html":{"href":"https://github.com/fib0n/Orm/pull/1"},"issue":{"href":"https://api.github.com/repos/fib0n/Orm/issues/1"},"comments":{"href":"https://api.github.com/repos/fib0n/Orm/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/fib0n/Orm/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/fib0n/Orm/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/fib0n/Orm/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/fib0n/Orm/statuses/cc8dae0453d5edf86edf1334be6fb4444c4165f4"}}}}