{"id":37024532,"url":"https://github.com/ferdinand-swoboda/folo","last_synced_at":"2026-01-14T02:58:14.627Z","repository":{"id":37100227,"uuid":"266540374","full_name":"ferdinand-swoboda/folo","owner":"ferdinand-swoboda","description":"A jOOQ object-relational loader.","archived":false,"fork":true,"pushed_at":"2025-10-03T07:03:49.000Z","size":483,"stargazers_count":1,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T17:20:35.840Z","etag":null,"topics":["java","jooq","sql"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"PicnicSupermarket/jolo","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ferdinand-swoboda.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-24T12:53:18.000Z","updated_at":"2025-08-20T07:09:03.000Z","dependencies_parsed_at":"2023-02-19T15:35:20.317Z","dependency_job_id":null,"html_url":"https://github.com/ferdinand-swoboda/folo","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ferdinand-swoboda/folo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferdinand-swoboda%2Ffolo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferdinand-swoboda%2Ffolo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferdinand-swoboda%2Ffolo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferdinand-swoboda%2Ffolo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ferdinand-swoboda","download_url":"https://codeload.github.com/ferdinand-swoboda/folo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferdinand-swoboda%2Ffolo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408799,"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":["java","jooq","sql"],"created_at":"2026-01-14T02:58:13.808Z","updated_at":"2026-01-14T02:58:14.618Z","avatar_url":"https://github.com/ferdinand-swoboda.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Folo\n\n[![Build Status][gh-actions-badge]][gh-actions-builds]\n[![Maven Central][maven-central-badge]][maven-central-browse]\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nSuccessor to [Jolo], a _jOOQ Loader_. Folo is a utility library to add basic object-relation mapping to\nyour [jOOQ][jooq] code.\n\n## Features\n\n- Easy specification of relations between entities using a chaining API.\n- Implements `java.util.stream.Collector` allowing object instantiation using jOOQ's native `ResultQuery#collect`\n  method; the loader can additionally call setters to instantiate relationships between entities.\n- Performs foreign key checks to see whether the defined relationships make sense.\n- Extra checks on field names of returned records to prevent loading fields from one table as fields of another (no\n  implicit conversion of `FOO.FIELD` to `BAR.FIELD`).\n- Supports circular references.\n- Supports adding extra (non-table) fields to entities.\n\n## Example usage\n\nLet's assume we are working with the following table structure:\n\n```sql\nCREATE TABLE Dog\n(\n    id     bigserial PRIMARY KEY,\n    name   text,\n    weight int\n);\n\nCREATE TABLE Flea\n(\n    id     bigserial PRIMARY KEY,\n    dog_id bigint REFERENCES Dog,\n    weight int\n)\n```\n\nAnd in Java you have modelled your dogs and fleas using POJOs that are serialisable using standard jOOQ functionality:\n\n```java\nclass Dog {\n    private long id;\n    private String name;\n    private int weight;\n    private List\u003cFlea\u003e fleas;\n\n    /* Getters and setters for ID, name \u0026 weight. */\n\n    @Transient\n    public List\u003cFlea\u003e getFleas() {\n        return fleas;\n    }\n\n    public void setFleas(List\u003cFlea\u003e fleas) {\n        this.fleas = fleas;\n    }\n}\n\nclass Flea {\n    private long id;\n    private int weight;\n\n    /* Getters and setters. */\n}\n```\n\nUsing this library, you can specify how to instantiate the relationship between those POJOs\n(i.e., how to fill the `fleas` property of `Dog`):\n\n```java\nclass LoaderUtil {\n    static Loader\u003cDog\u003e createLoader() {\n        var dog = new Entity\u003c\u003e(Tables.DOG, Dog.class);\n        var flea = new Entity\u003c\u003e(Tables.FLEA, Flea.class);\n        return Loader.of(dog).oneToMany(dog, flea).setManyLeft(Dog::setFleas).build();\n    }\n}\n```\n\nThen in the code that executes the query, you can use the loader to instantiate and link POJO classes:\n\n```java\nclass Repository {\n    private static final Loader\u003cDog\u003e LOADER = createLoader();\n\n    private final DSLContext context;\n\n    void dogLog() {\n        List\u003cDog\u003e dogs = context.select()\n                .from(DOG)\n                .leftJoin(FLEA)\n                .on(FLEA.DOG_ID.eq(DOG.ID))\n                .collect(toLinkedObjectsWith(LOADER));\n\n        for (Dog dog : dogs) {\n            int fleaWeight = dog.getFleas().stream().mapToInt(Flea::getWeight).sum();\n            LOG.info(\"%s is %.0f%% fleas\",\n                    dog.getName(),\n                    fleaWeight * 100.0 / dog.getWeight());\n        }\n    }\n}\n```\n\n## How to Install\n\nArtifacts are hosted on [Maven's Central Repository][maven-central-browse]:\n\n### Gradle\n\n```groovy\ndependencies {\n    compile 'io.github.ferdinand-swoboda.folo:folo:2.0.0'\n}\n```\n\n### Maven\n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.ferdinand-swoboda.folo\u003c/groupId\u003e\n    \u003cartifactId\u003efolo\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Limitations/Potential improvements\n\n- Make use of Java modules (introduced in Java 9).\n- Only primary / foreign keys of (Java) type `long` are supported i.e. no composite or UUID keys.\n- Investigate `@Contract` annotations (`org.jetbrains`).\n- Relation mapping does not work for entities that are not based on a table in the DB schema.\n\n## Contributing\n\nContributions of any kind are welcome! Feel free to file an [issue][new-issue] or open a\n[pull request][new-pr].\n\nWhen submitting changes, please make every effort to follow existing conventions and style in order to keep the code as\nreadable as possible. New code must be covered by tests. As a rule of thumb, overall test coverage should not\ndecrease, performance metrics should stay the same or improve.\n\n[jolo]: https://github.com/picnicsupermarket/jolo\n\n[jooq]: https://www.jooq.org\n\n[maven-central-badge]: https://img.shields.io/maven-central/v/io.github.ferdinand-swoboda.folo/folo\n[maven-central-browse]: https://search.maven.org/artifact/io.github.ferdinand-swoboda.folo/folo\n\n[new-issue]: https://github.com/ferdinand-swoboda/folo/issues/new\n\n[new-pr]: https://github.com/ferdinand-swoboda/folo/compare\n\n[gh-actions-badge]: https://github.com/ferdinand-swoboda/folo/actions/workflows/development.yaml/badge.svg\n[gh-actions-builds]: https://github.com/ferdinand-swoboda/folo/actions/workflows/development.yaml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fferdinand-swoboda%2Ffolo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fferdinand-swoboda%2Ffolo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fferdinand-swoboda%2Ffolo/lists"}