{"action":"created","comment":{"url":"https://api.github.com/repos/nwarrick6425/java_class/pulls/comments/202160034","pull_request_review_id":136805484,"id":202160034,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjE2MDAzNA==","diff_hunk":"@@ -0,0 +1,155 @@\n+package edu.nicholaidudakiwwarrick.advancedjava.services;\n+\n+import edu.nicholaidudakiwwarrick.advancedjava.model.DatabasePerson;\n+import edu.nicholaidudakiwwarrick.advancedjava.model.DatabasePersonStock;\n+import edu.nicholaidudakiwwarrick.advancedjava.model.DatabaseStockSymbol;\n+import edu.nicholaidudakiwwarrick.advancedjava.util.DatabaseUtils;\n+import org.hibernate.Criteria;\n+import org.hibernate.HibernateException;\n+import org.hibernate.Session;\n+import org.hibernate.Transaction;\n+import org.hibernate.criterion.Restrictions;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+/**\n+ * This class is a concrete implementation of PersonService that reads data from a database.\n+ *\n+ * @author Nicholai Dudakiw-Warrick\n+ */\n+public class DatabasePersonService implements PersonService {\n+\n+    public static final DatabasePersonService INSTANCE = new DatabasePersonService();\n+\n+    // hides the constructor and delegates instance creation through ServiceFactory\n+    protected DatabasePersonService() {\n+    }\n+\n+    /**\n+     * Gets a list of all persons stored in the \"person\" database.\n+     * Changes made by mutating objects in the returned list do not propagate to the database.\n+     * @return a list of Person instances\n+     * @throws PersonServiceException if a service can not perform the requested operation\n+     */\n+    public final List<DatabasePerson> getPersons() throws PersonServiceException {\n+        Session session = DatabaseUtils.getSessionFactory().openSession();\n+        List<DatabasePerson> persons = null;\n+        Transaction transaction = null;\n+        try {\n+            // assigns all instances of Person within session to Criteria\n+            // then converts Criteria to a list of the criteria type which is Person.class\n+            transaction = session.beginTransaction();\n+            Criteria criteria = session.createCriteria(DatabasePerson.class);\n+\n+            // intentional suppression of warnings for unchecked exceptions thrown by criteria.list()\n+            @SuppressWarnings(\"unchecked\") List<DatabasePerson> list = criteria.list();\n+            persons = list;\n+        } catch (HibernateException e) {\n+            if (transaction != null && transaction.isActive()) {\n+                transaction.rollback();  // close transaction\n+            }\n+            throw new PersonServiceException(\"Could not get Person data. \" + e.getMessage(), e);","path":"src/main/java/edu/nicholaidudakiwwarrick/advancedjava/services/DatabasePersonService.java","position":52,"original_position":52,"commit_id":"59ad58a448aa8a63843a709e3e9a71e7e38dbc5f","original_commit_id":"59ad58a448aa8a63843a709e3e9a71e7e38dbc5f","user":{"login":"smarks","id":493423,"node_id":"MDQ6VXNlcjQ5MzQyMw==","avatar_url":"https://avatars1.githubusercontent.com/u/493423?v=4","gravatar_id":"","url":"https://api.github.com/users/smarks","html_url":"https://github.com/smarks","followers_url":"https://api.github.com/users/smarks/followers","following_url":"https://api.github.com/users/smarks/following{/other_user}","gists_url":"https://api.github.com/users/smarks/gists{/gist_id}","starred_url":"https://api.github.com/users/smarks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarks/subscriptions","organizations_url":"https://api.github.com/users/smarks/orgs","repos_url":"https://api.github.com/users/smarks/repos","events_url":"https://api.github.com/users/smarks/events{/privacy}","received_events_url":"https://api.github.com/users/smarks/received_events","type":"User","site_admin":false},"body":"so this might be a problem because the finally statement will always get called. ","created_at":"2018-07-12T19:58:32Z","updated_at":"2018-07-12T19:58:32Z","html_url":"https://github.com/nwarrick6425/java_class/pull/7#discussion_r202160034","pull_request_url":"https://api.github.com/repos/nwarrick6425/java_class/pulls/7","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/nwarrick6425/java_class/pulls/comments/202160034"},"html":{"href":"https://github.com/nwarrick6425/java_class/pull/7#discussion_r202160034"},"pull_request":{"href":"https://api.github.com/repos/nwarrick6425/java_class/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/nwarrick6425/java_class/pulls/7","id":199073714,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5MDczNzE0","html_url":"https://github.com/nwarrick6425/java_class/pull/7","diff_url":"https://github.com/nwarrick6425/java_class/pull/7.diff","patch_url":"https://github.com/nwarrick6425/java_class/pull/7.patch","issue_url":"https://api.github.com/repos/nwarrick6425/java_class/issues/7","number":7,"state":"open","locked":false,"title":"Assignment six","user":{"login":"nwarrick6425","id":13597191,"node_id":"MDQ6VXNlcjEzNTk3MTkx","avatar_url":"https://avatars0.githubusercontent.com/u/13597191?v=4","gravatar_id":"","url":"https://api.github.com/users/nwarrick6425","html_url":"https://github.com/nwarrick6425","followers_url":"https://api.github.com/users/nwarrick6425/followers","following_url":"https://api.github.com/users/nwarrick6425/following{/other_user}","gists_url":"https://api.github.com/users/nwarrick6425/gists{/gist_id}","starred_url":"https://api.github.com/users/nwarrick6425/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwarrick6425/subscriptions","organizations_url":"https://api.github.com/users/nwarrick6425/orgs","repos_url":"https://api.github.com/users/nwarrick6425/repos","events_url":"https://api.github.com/users/nwarrick6425/events{/privacy}","received_events_url":"https://api.github.com/users/nwarrick6425/received_events","type":"User","site_admin":false},"body":"Assignment 6 done!","created_at":"2018-07-03T20:21:03Z","updated_at":"2018-07-12T19:58:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a1462a71e944d33bc158547594837b1fc0ff206","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nwarrick6425/java_class/pulls/7/commits","review_comments_url":"https://api.github.com/repos/nwarrick6425/java_class/pulls/7/comments","review_comment_url":"https://api.github.com/repos/nwarrick6425/java_class/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nwarrick6425/java_class/issues/7/comments","statuses_url":"https://api.github.com/repos/nwarrick6425/java_class/statuses/59ad58a448aa8a63843a709e3e9a71e7e38dbc5f","head":{"label":"nwarrick6425:assignment_six","ref":"assignment_six","sha":"59ad58a448aa8a63843a709e3e9a71e7e38dbc5f","user":{"login":"nwarrick6425","id":13597191,"node_id":"MDQ6VXNlcjEzNTk3MTkx","avatar_url":"https://avatars0.githubusercontent.com/u/13597191?v=4","gravatar_id":"","url":"https://api.github.com/users/nwarrick6425","html_url":"https://github.com/nwarrick6425","followers_url":"https://api.github.com/users/nwarrick6425/followers","following_url":"https://api.github.com/users/nwarrick6425/following{/other_user}","gists_url":"https://api.github.com/users/nwarrick6425/gists{/gist_id}","starred_url":"https://api.github.com/users/nwarrick6425/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwarrick6425/subscriptions","organizations_url":"https://api.github.com/users/nwarrick6425/orgs","repos_url":"https://api.github.com/users/nwarrick6425/repos","events_url":"https://api.github.com/users/nwarrick6425/events{/privacy}","received_events_url":"https://api.github.com/users/nwarrick6425/received_events","type":"User","site_admin":false},"repo":{"id":134661102,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ2NjExMDI=","name":"java_class","full_name":"nwarrick6425/java_class","owner":{"login":"nwarrick6425","id":13597191,"node_id":"MDQ6VXNlcjEzNTk3MTkx","avatar_url":"https://avatars0.githubusercontent.com/u/13597191?v=4","gravatar_id":"","url":"https://api.github.com/users/nwarrick6425","html_url":"https://github.com/nwarrick6425","followers_url":"https://api.github.com/users/nwarrick6425/followers","following_url":"https://api.github.com/users/nwarrick6425/following{/other_user}","gists_url":"https://api.github.com/users/nwarrick6425/gists{/gist_id}","starred_url":"https://api.github.com/users/nwarrick6425/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwarrick6425/subscriptions","organizations_url":"https://api.github.com/users/nwarrick6425/orgs","repos_url":"https://api.github.com/users/nwarrick6425/repos","events_url":"https://api.github.com/users/nwarrick6425/events{/privacy}","received_events_url":"https://api.github.com/users/nwarrick6425/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nwarrick6425/java_class","description":"My Java Class Project","fork":false,"url":"https://api.github.com/repos/nwarrick6425/java_class","forks_url":"https://api.github.com/repos/nwarrick6425/java_class/forks","keys_url":"https://api.github.com/repos/nwarrick6425/java_class/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nwarrick6425/java_class/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nwarrick6425/java_class/teams","hooks_url":"https://api.github.com/repos/nwarrick6425/java_class/hooks","issue_events_url":"https://api.github.com/repos/nwarrick6425/java_class/issues/events{/number}","events_url":"https://api.github.com/repos/nwarrick6425/java_class/events","assignees_url":"https://api.github.com/repos/nwarrick6425/java_class/assignees{/user}","branches_url":"https://api.github.com/repos/nwarrick6425/java_class/branches{/branch}","tags_url":"https://api.github.com/repos/nwarrick6425/java_class/tags","blobs_url":"https://api.github.com/repos/nwarrick6425/java_class/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nwarrick6425/java_class/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nwarrick6425/java_class/git/refs{/sha}","trees_url":"https://api.github.com/repos/nwarrick6425/java_class/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nwarrick6425/java_class/statuses/{sha}","languages_url":"https://api.github.com/repos/nwarrick6425/java_class/languages","stargazers_url":"https://api.github.com/repos/nwarrick6425/java_class/stargazers","contributors_url":"https://api.github.com/repos/nwarrick6425/java_class/contributors","subscribers_url":"https://api.github.com/repos/nwarrick6425/java_class/subscribers","subscription_url":"https://api.github.com/repos/nwarrick6425/java_class/subscription","commits_url":"https://api.github.com/repos/nwarrick6425/java_class/commits{/sha}","git_commits_url":"https://api.github.com/repos/nwarrick6425/java_class/git/commits{/sha}","comments_url":"https://api.github.com/repos/nwarrick6425/java_class/comments{/number}","issue_comment_url":"https://api.github.com/repos/nwarrick6425/java_class/issues/comments{/number}","contents_url":"https://api.github.com/repos/nwarrick6425/java_class/contents/{+path}","compare_url":"https://api.github.com/repos/nwarrick6425/java_class/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nwarrick6425/java_class/merges","archive_url":"https://api.github.com/repos/nwarrick6425/java_class/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nwarrick6425/java_class/downloads","issues_url":"https://api.github.com/repos/nwarrick6425/java_class/issues{/number}","pulls_url":"https://api.github.com/repos/nwarrick6425/java_class/pulls{/number}","milestones_url":"https://api.github.com/repos/nwarrick6425/java_class/milestones{/number}","notifications_url":"https://api.github.com/repos/nwarrick6425/java_class/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nwarrick6425/java_class/labels{/name}","releases_url":"https://api.github.com/repos/nwarrick6425/java_class/releases{/id}","deployments_url":"https://api.github.com/repos/nwarrick6425/java_class/deployments","created_at":"2018-05-24T04:31:10Z","updated_at":"2018-06-25T03:53:15Z","pushed_at":"2018-07-07T19:46:19Z","git_url":"git://github.com/nwarrick6425/java_class.git","ssh_url":"git@github.com:nwarrick6425/java_class.git","clone_url":"https://github.com/nwarrick6425/java_class.git","svn_url":"https://github.com/nwarrick6425/java_class","homepage":null,"size":85,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"nwarrick6425:master","ref":"master","sha":"f47e534b0bdfbc18dbd7ab9aa5d32c73b383f71e","user":{"login":"nwarrick6425","id":13597191,"node_id":"MDQ6VXNlcjEzNTk3MTkx","avatar_url":"https://avatars0.githubusercontent.com/u/13597191?v=4","gravatar_id":"","url":"https://api.github.com/users/nwarrick6425","html_url":"https://github.com/nwarrick6425","followers_url":"https://api.github.com/users/nwarrick6425/followers","following_url":"https://api.github.com/users/nwarrick6425/following{/other_user}","gists_url":"https://api.github.com/users/nwarrick6425/gists{/gist_id}","starred_url":"https://api.github.com/users/nwarrick6425/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwarrick6425/subscriptions","organizations_url":"https://api.github.com/users/nwarrick6425/orgs","repos_url":"https://api.github.com/users/nwarrick6425/repos","events_url":"https://api.github.com/users/nwarrick6425/events{/privacy}","received_events_url":"https://api.github.com/users/nwarrick6425/received_events","type":"User","site_admin":false},"repo":{"id":134661102,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ2NjExMDI=","name":"java_class","full_name":"nwarrick6425/java_class","owner":{"login":"nwarrick6425","id":13597191,"node_id":"MDQ6VXNlcjEzNTk3MTkx","avatar_url":"https://avatars0.githubusercontent.com/u/13597191?v=4","gravatar_id":"","url":"https://api.github.com/users/nwarrick6425","html_url":"https://github.com/nwarrick6425","followers_url":"https://api.github.com/users/nwarrick6425/followers","following_url":"https://api.github.com/users/nwarrick6425/following{/other_user}","gists_url":"https://api.github.com/users/nwarrick6425/gists{/gist_id}","starred_url":"https://api.github.com/users/nwarrick6425/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwarrick6425/subscriptions","organizations_url":"https://api.github.com/users/nwarrick6425/orgs","repos_url":"https://api.github.com/users/nwarrick6425/repos","events_url":"https://api.github.com/users/nwarrick6425/events{/privacy}","received_events_url":"https://api.github.com/users/nwarrick6425/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nwarrick6425/java_class","description":"My Java Class Project","fork":false,"url":"https://api.github.com/repos/nwarrick6425/java_class","forks_url":"https://api.github.com/repos/nwarrick6425/java_class/forks","keys_url":"https://api.github.com/repos/nwarrick6425/java_class/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nwarrick6425/java_class/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nwarrick6425/java_class/teams","hooks_url":"https://api.github.com/repos/nwarrick6425/java_class/hooks","issue_events_url":"https://api.github.com/repos/nwarrick6425/java_class/issues/events{/number}","events_url":"https://api.github.com/repos/nwarrick6425/java_class/events","assignees_url":"https://api.github.com/repos/nwarrick6425/java_class/assignees{/user}","branches_url":"https://api.github.com/repos/nwarrick6425/java_class/branches{/branch}","tags_url":"https://api.github.com/repos/nwarrick6425/java_class/tags","blobs_url":"https://api.github.com/repos/nwarrick6425/java_class/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nwarrick6425/java_class/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nwarrick6425/java_class/git/refs{/sha}","trees_url":"https://api.github.com/repos/nwarrick6425/java_class/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nwarrick6425/java_class/statuses/{sha}","languages_url":"https://api.github.com/repos/nwarrick6425/java_class/languages","stargazers_url":"https://api.github.com/repos/nwarrick6425/java_class/stargazers","contributors_url":"https://api.github.com/repos/nwarrick6425/java_class/contributors","subscribers_url":"https://api.github.com/repos/nwarrick6425/java_class/subscribers","subscription_url":"https://api.github.com/repos/nwarrick6425/java_class/subscription","commits_url":"https://api.github.com/repos/nwarrick6425/java_class/commits{/sha}","git_commits_url":"https://api.github.com/repos/nwarrick6425/java_class/git/commits{/sha}","comments_url":"https://api.github.com/repos/nwarrick6425/java_class/comments{/number}","issue_comment_url":"https://api.github.com/repos/nwarrick6425/java_class/issues/comments{/number}","contents_url":"https://api.github.com/repos/nwarrick6425/java_class/contents/{+path}","compare_url":"https://api.github.com/repos/nwarrick6425/java_class/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nwarrick6425/java_class/merges","archive_url":"https://api.github.com/repos/nwarrick6425/java_class/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nwarrick6425/java_class/downloads","issues_url":"https://api.github.com/repos/nwarrick6425/java_class/issues{/number}","pulls_url":"https://api.github.com/repos/nwarrick6425/java_class/pulls{/number}","milestones_url":"https://api.github.com/repos/nwarrick6425/java_class/milestones{/number}","notifications_url":"https://api.github.com/repos/nwarrick6425/java_class/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nwarrick6425/java_class/labels{/name}","releases_url":"https://api.github.com/repos/nwarrick6425/java_class/releases{/id}","deployments_url":"https://api.github.com/repos/nwarrick6425/java_class/deployments","created_at":"2018-05-24T04:31:10Z","updated_at":"2018-06-25T03:53:15Z","pushed_at":"2018-07-07T19:46:19Z","git_url":"git://github.com/nwarrick6425/java_class.git","ssh_url":"git@github.com:nwarrick6425/java_class.git","clone_url":"https://github.com/nwarrick6425/java_class.git","svn_url":"https://github.com/nwarrick6425/java_class","homepage":null,"size":85,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nwarrick6425/java_class/pulls/7"},"html":{"href":"https://github.com/nwarrick6425/java_class/pull/7"},"issue":{"href":"https://api.github.com/repos/nwarrick6425/java_class/issues/7"},"comments":{"href":"https://api.github.com/repos/nwarrick6425/java_class/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/nwarrick6425/java_class/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/nwarrick6425/java_class/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nwarrick6425/java_class/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/nwarrick6425/java_class/statuses/59ad58a448aa8a63843a709e3e9a71e7e38dbc5f"}},"author_association":"OWNER"}}
{"actor":{"display_login":"smarks"}}