{"action":"created","issue":{"url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1276","labels_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1276/labels{/name}","comments_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1276/comments","events_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1276/events","html_url":"https://github.com/dropwizard/dropwizard/pull/1276","id":110795046,"number":1276,"title":"Add support for several Hibernate bundles","user":{"login":"arteam","id":1717632,"avatar_url":"https://avatars.githubusercontent.com/u/1717632?v=3","gravatar_id":"","url":"https://api.github.com/users/arteam","html_url":"https://github.com/arteam","followers_url":"https://api.github.com/users/arteam/followers","following_url":"https://api.github.com/users/arteam/following{/other_user}","gists_url":"https://api.github.com/users/arteam/gists{/gist_id}","starred_url":"https://api.github.com/users/arteam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arteam/subscriptions","organizations_url":"https://api.github.com/users/arteam/orgs","repos_url":"https://api.github.com/users/arteam/repos","events_url":"https://api.github.com/users/arteam/events{/privacy}","received_events_url":"https://api.github.com/users/arteam/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-10T13:31:20Z","updated_at":"2015-10-12T14:30:59Z","closed_at":"2015-10-12T14:24:10Z","pull_request":{"url":"https://api.github.com/repos/dropwizard/dropwizard/pulls/1276","html_url":"https://github.com/dropwizard/dropwizard/pull/1276","diff_url":"https://github.com/dropwizard/dropwizard/pull/1276.diff","patch_url":"https://github.com/dropwizard/dropwizard/pull/1276.patch"},"body":"In some cases one need to simultaneously connect to several relational databases. Users want to use Hibernate to access each database. The problem that the current implementation of\r\n`UnitOfWorkApplicationListener` supports only one session factory, which ultimately restricts ability to support several session factories.\r\n\r\nAnother problem is that users should have the ability to specify the name of datasource, against which a transaction should be opened in a resource method.\r\n\r\nThis change:\r\n\r\n* Adds the method `value` to the `@UnitOfWork` annotation. It allows to specify the name of Hibernate bundle (session factory). By default it specifies the default bundle.\r\n\r\n* Replaces the single session factory in `UnitOfWorkApplicationListener` to a map of session factories by names of bundles.\r\n\r\n* The correct session factory is determined in runtime, based on the `value` method in the corresponding `@UnitOfWork` annotation.\r\n\r\nIn the result users can simultaneously use declarative transactions on several databases, access to which is managed by Hibernate.\r\n\r\nFixes #1217"},"comment":{"url":"https://api.github.com/repos/dropwizard/dropwizard/issues/comments/147413877","html_url":"https://github.com/dropwizard/dropwizard/pull/1276#issuecomment-147413877","issue_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1276","id":147413877,"user":{"login":"jplock","id":49093,"avatar_url":"https://avatars.githubusercontent.com/u/49093?v=3","gravatar_id":"","url":"https://api.github.com/users/jplock","html_url":"https://github.com/jplock","followers_url":"https://api.github.com/users/jplock/followers","following_url":"https://api.github.com/users/jplock/following{/other_user}","gists_url":"https://api.github.com/users/jplock/gists{/gist_id}","starred_url":"https://api.github.com/users/jplock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jplock/subscriptions","organizations_url":"https://api.github.com/users/jplock/orgs","repos_url":"https://api.github.com/users/jplock/repos","events_url":"https://api.github.com/users/jplock/events{/privacy}","received_events_url":"https://api.github.com/users/jplock/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T14:30:59Z","updated_at":"2015-10-12T14:30:59Z","body":"Should this be in `0.9.0` or `1.0.0`?  (related, we really need to release `0.9.0` if there aren't any show stoppers)"}}