{"id":37019616,"url":"https://github.com/microtweak/jbx4j","last_synced_at":"2026-01-14T02:11:08.903Z","repository":{"id":57719815,"uuid":"127572572","full_name":"microtweak/jbx4j","owner":"microtweak","description":"JSON Binding eXtension for JPA","archived":false,"fork":false,"pushed_at":"2020-11-26T03:53:56.000Z","size":101,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-11T19:36:02.399Z","etag":null,"topics":["jpa","json","serializer"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microtweak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-31T21:25:46.000Z","updated_at":"2022-05-29T23:48:59.000Z","dependencies_parsed_at":"2022-09-26T16:40:24.076Z","dependency_job_id":null,"html_url":"https://github.com/microtweak/jbx4j","commit_stats":null,"previous_names":["friendlyjava/jpa-json"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/microtweak/jbx4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microtweak%2Fjbx4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microtweak%2Fjbx4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microtweak%2Fjbx4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microtweak%2Fjbx4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microtweak","download_url":"https://codeload.github.com/microtweak/jbx4j/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microtweak%2Fjbx4j/sbom","scorecard":{"id":411536,"data":{"date":"2025-08-11","repo":{"name":"github.com/microtweak/jbx4j","commit":"02934fe973799b5d616a0e8360bc531ed221c08b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/18 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T22:49:15.143Z","repository_id":57719815,"created_at":"2025-08-18T22:49:15.143Z","updated_at":"2025-08-18T22:49:15.143Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":["jpa","json","serializer"],"created_at":"2026-01-14T02:11:08.159Z","updated_at":"2026-01-14T02:11:08.876Z","avatar_url":"https://github.com/microtweak.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jbx4j - JSON Binding eXtension for JPA\n\n[![][maven img]][maven]\n[![][javadoc img]][javadoc]\n[![][release img]][release]\n[![][license img]][license]\n\n[maven]:http://search.maven.org/#search|gav|1|g:\"com.github.microtweak\"%20AND%20a:\"jbx4j\"\n[maven img]:https://maven-badges.herokuapp.com/maven-central/com.github.microtweak/jbx4j/badge.svg\n\n[javadoc]:https://javadoc.io/doc/com.github.microtweak/jbx4j-core\n[javadoc img]:https://javadoc.io/badge/com.github.microtweak/jbx4j-core.svg\n\n[release]:https://github.com/microtweak/jbx4j/releases\n[release img]:https://img.shields.io/github/release/microtweak/jbx4j.svg\n\n[license]:LICENSE\n[license img]:https://img.shields.io/badge/License-MIT-yellow.svg\n\nA helper library for JPA Entity (de)serialization in JSON.\n\nWhen we work with JPA and need to (de)serialize JPA entities to JSON (or any other format) we always encounter some problems:\n\n* Relationship attributes (OneToOne, ManyToOne, OneToMany and ManyToMany) that are Lazy and the JSON Binding framework (like Jackson, GSON, etc) will cause the JPA Provider to make unnecessary queries to the database;\n* Circular reference between JPA mapping;\n* Use of DTOs and Mapping frameworks (like ModelMapper, MapStruct, Dozer, etc.) to bypass the above problems, making development more complex and verbose;\n* Need to create DTOs and Mappers even for simple entities (with two or three attributes).\n\nThis library helps in the process of (de)serialization of the JPA entity, reducing the difficulties mentioned above.\n\n## Support\nInitially we are providing support to the framework below:\n\nFramework       | Type | Minimal version | Note\n----------------|:----:|----------------:|--------------------------------------------------------|\n Hibernate      | JPA  | 5.2             |                                                        |\n EclipseLink    | JPA  | 2.5             | Works only with Weaving enabled. Experimental support  |\n Jackson        | JSON | 2.9.4           |                                                        |\n\n## Getting Started\n\n1. You must add a dependency in your project:\n    ```xml\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.microtweak\u003c/groupId\u003e\n        \u003cartifactId\u003ejbx4j-hibernate\u003c/artifactId\u003e\n        \u003cversion\u003e${jbx4j.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n   \n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.microtweak\u003c/groupId\u003e\n        \u003cartifactId\u003ejbx4j-jackson\u003c/artifactId\u003e\n        \u003cversion\u003e${jbx4j.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n    ```\n\n2. Now let's configure the application to use Jbx4j. Although the following examples are based on the CDI, it is not a requirement to use this library. Create a class that implements EntityResolver as in the example below. You can create multiple EntityResolvers as needed.\n\n    ```java\n    @ApplicationScoped\n    public class GenericEntityResolver implements EntityResolver\u003cObject\u003e {\n    \n        @Inject\n        private EntityManager entityManager;\n\n        @Override\n        public boolean canResolve(Object declaredAt, Class\u003cObject\u003e rawType, JpaEntityData\u003cObject\u003e data, List\u003cAnnotation\u003e annotations) {\n            return rawType.isAnnotationPresent(Entity.class);\n        }\n    \n        @Override\n        public Object resolve(Object declaredAt, Class\u003cObject\u003e rawType, JpaEntityData\u003cObject\u003e data, List\u003cAnnotation\u003e annotations) {\n            Object primaryKey = data.get(\"id\");\n        \n            if (primaryKey == null) {\n                return null;\n            }\n        \n            // Logic to solve the entity. You can use a find or a complex query JPQL\n            return entityManager.find(rawType, primaryKey);\n        }    \n\n    }\n    ```\n\n3. Instantiate the Jbx4j module and add all the EntityResolvers created in the module. After that, register the module in Jackson.\n\n    ```java\n    public class JacksonProducer {\n    \n        // Ask the CDI to find all the EntityResolver in the application\n        @Inject\n        private Instance\u003cEntityResolver\u003c?\u003e\u003e resolvers;\n        \n        @Produces\n        @Singleton\n        public ObjectMapper createJacksonObjectMapper() {\n            ObjectMapper mapper = new ObjectMapper();\n            \n            // Instances the Jbx4j module for Jackson\n            Jbx4jJacksonModule jbx4jModule = new Jbx4jJacksonModule();\n    \n            // Adds all EntityResolvers found by CDI in the module created earlier\n            resolvers.forEach(er -\u003e jbx4jModule.getResolverManager().add(er));\n            \n            // Register the module in Jackson\n            mapper.registerModule(jpaJacksonModule);\n            \n            return mapper;\n        }\n        \n    }\n    ```\n\nAfter these steps, simply ask Jackson's ObjectMapper to (de)serialize your JPA entity as you are already accustomed to doing with other Java classes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrotweak%2Fjbx4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrotweak%2Fjbx4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrotweak%2Fjbx4j/lists"}