{"id":31970535,"url":"https://github.com/hubspot/guice-transactional","last_synced_at":"2025-10-14T19:16:10.860Z","repository":{"id":35314525,"uuid":"39576074","full_name":"HubSpot/guice-transactional","owner":"HubSpot","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-24T14:38:07.000Z","size":68,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":149,"default_branch":"master","last_synced_at":"2025-07-24T19:27:33.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HubSpot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-07-23T15:41:32.000Z","updated_at":"2025-07-24T14:38:10.000Z","dependencies_parsed_at":"2024-03-10T19:30:00.965Z","dependency_job_id":"ae0f7e07-d78d-4597-9ed2-0defd6804118","html_url":"https://github.com/HubSpot/guice-transactional","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/HubSpot/guice-transactional","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fguice-transactional","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fguice-transactional/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fguice-transactional/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fguice-transactional/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HubSpot","download_url":"https://codeload.github.com/HubSpot/guice-transactional/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fguice-transactional/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020652,"owners_count":26086895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-14T19:16:02.201Z","updated_at":"2025-10-14T19:16:10.853Z","avatar_url":"https://github.com/HubSpot.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# guice-transactional\n\n## Overview\n\nMiss the convenience of `@Transactional` but have no interest in using JPA? Then guice-transactional is for you.\n\nguice-transactional lets you annotate methods using the standard `@jakarta.transaction.Transactional` annotation and works as you\nexpect; transactions will be started before the method is called and committed or rolled back after the method completes. It\nalso implements all of the\n[transaction types](https://jakarta.ee/specifications/transactions/2.0/apidocs/jakarta/transaction/transactional.txtype) for\nmore complicated use-cases.\n\nguice-transactional just needs access to the underlying `javax.sql.DataSource` so it will work with any persistence framework,\nincluding jDBI, Hibernate, MyBatis, QueryRunner, or even raw JDBC.\n\n## Maven Dependency\n\nTo use on Maven-based projects, add the following dependency:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.hubspot.guice\u003c/groupId\u003e\n  \u003cartifactId\u003eguice-transactional\u003c/artifactId\u003e\n  \u003cversion\u003e0.4.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\nThere are a few steps to get up and running with guice-transactional:\n\n1. Install `TransactionalModule` when building your Guice injector, this sets up the necessary method interceptor\n\n2. When configuring your persistence framework, wrap your `DataSource` in a `TransactionalDataSource`\n\n3. Annotate methods with `@jakarta.transaction.Transactional` and profit! The only restriction is that these methods must be on\nobjects that were created by Guice and they must not have `private` access\n\n## How Does it Work?\n\nWhen you install `TransactionalModule`, an interceptor is added to methods annotated with `@jakarta.transaction.Transactional`.\nWhen a transactional method is entered, the interceptor stores this state in a `ThreadLocal`. The `TransactionalDataSource` checks\nthe interceptor for this flag when a connection is requested. If the flag is set, it disables auto-commit and returns the same\nconnection for the duration of the transactional method. Once the transactional method completes, the interceptor either commits or\nrolls back the transaction depending on the result of the method call and then clears the thread local state.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubspot%2Fguice-transactional","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhubspot%2Fguice-transactional","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubspot%2Fguice-transactional/lists"}