{"id":36603564,"url":"https://github.com/faire/yawn","last_synced_at":"2026-04-02T22:02:36.951Z","repository":{"id":318371048,"uuid":"1003916612","full_name":"Faire/yawn","owner":"Faire","description":"Yawn is a Kotlin ORM-wrapper that provides a type-safe, expressive, Criteria-style query syntax using custom KSP-generated entity metadata.","archived":false,"fork":false,"pushed_at":"2026-04-01T20:19:13.000Z","size":679,"stargazers_count":53,"open_issues_count":20,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-02T07:51:53.957Z","etag":null,"topics":["database","hacktoberfest","hibernate","kotlin","ksp","orm","query"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/Faire.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-17T20:46:44.000Z","updated_at":"2026-04-01T19:39:40.000Z","dependencies_parsed_at":"2025-10-06T20:45:18.428Z","dependency_job_id":null,"html_url":"https://github.com/Faire/yawn","commit_stats":null,"previous_names":["faire/yawn"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/Faire/yawn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faire%2Fyawn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faire%2Fyawn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faire%2Fyawn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faire%2Fyawn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Faire","download_url":"https://codeload.github.com/Faire/yawn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faire%2Fyawn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31317831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T21:35:00.834Z","status":"ssl_error","status_checked_at":"2026-04-02T21:34:59.806Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["database","hacktoberfest","hibernate","kotlin","ksp","orm","query"],"created_at":"2026-01-12T08:41:23.618Z","updated_at":"2026-04-02T22:02:36.939Z","avatar_url":"https://github.com/Faire.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yawn\n\n**Yawn** is a thin encapsulation of the *Hibernate Criteria Query API* into a **Kotlin-friendly**, **type-safe** and **intuitive** interface.\n\nIt leverages [KSP](https://kotlinlang.org/docs/ksp-overview.html) to generate **type-safe definitions** used to power **Yawn Queries**.\n\n## Getting Started\n\n\u003e [!NOTE]\n\u003e 💡 Want to take a peek at a complete example we made of using Yawn in a multi-module Gradle project?\n\u003e [Check our example repo](https://github.com/faire/yawn-example).\n\n### Adding the Dependencies\n\nThere are two sets of dependencies you must add to your project to use Yawn.\n\n1. The `yawn-processor` dependency is what generates the definitions for your entities annotated with `@YawnEntity`.\n\n    That needs to be added as a `compileOnly` and also `ksp` dependency:\n\n    ```kotlin\n    compileOnly(\"com.faire.yawn:yawn-processor:$version\")\n    ksp(\"com.faire.yawn:yawn-processor:$version\")\n    ```\n\n    As an alternative, you can use the Yawn Gradle plugin to automatically add the processor for you - see the\n    [Yawn Gradle Plugin readme][yawn-gradle-plugin-readme] for more details. This is recommended for multi-module Gradle projects.\n\n1. The `yawn-api` as a regular dependency in order to actually make queries:\n\n    ```kotlin\n    implementation(\"com.faire.yawn:yawn-api:$version\")\n    ```\n\n### Annotate your Entities\n\nAnnotate your Hibernate entities with `@YawnEntity` in order to have the necessary table and column definitions generated for them.\n\n```kotlin\n@Entity\n@Table(name = \"books\")\n@YawnEntity // \u003c-- add this\nclass Book {\n  // ...\n}\n```\n\n### Wire your QueryFactory\n\nIn order to hook Yawn into your Hibernate setup, you need to provide a `QueryFactory` implementation that knows how map the Yawn models into a Hibernate query.\nFor inspiration, you can check out the [`YawnTestQueryFactory`][yawn-test-query-factory] implementation.\n\nTip: wrap the Yawn class creation within your transaction management code to make it easier to use throughout your codebase!\n\n### Write your queries\n\nFinally, you are ready! Now you can write your type-safe queries using the power of Yawn:\n\n```kotlin\n  val yawn = Yawn(queryFactory = YourQueryFactory(...))\n  val tolkienBooks = yawn.query(BookTable) { books -\u003e\n    val authors = join(books.author)\n    addEq(authors.name, \"J. R. R. Tolkien\")\n  }.list()\n```\n\nFor more advanced details, read through our [docs](/docs/README.md)!\n\n## Why Yawn?\n\n### Full type safety\n\nNo longer guess column names and types. Begone brittle strings. No runtime errors when running your tests (or even worse, in prod).\n\nWith **Yawn**, it is impossible to pass in the wrong type, enforced by our friend the compiler; join paths are guaranteed to be correct; project to data classes\nwith ease.\n\n### Find all the usages of column\n\nEasy to refactor, investigate, and safely delete fields. Analyze cascading impacts of your changes with ease.\n\nLeverage Kotlin’s powerful introspection and refactor tools like you already do with everything else.\n\n### Intellisense Suggestions\n\nUse the power of the IDE that we know and love, now for queries.\n\nGet code suggestions and hints from your coding environment.\n\n### Familiarity with the Hibernate Criteria syntax\n\nYawn keeps mostly the same syntax provided by Hibernate Criteria API, just adding type-safety as the cherry on top.\n\nIf you like that style of building queries, but want some type-safety on top, **Yawn** might just be for you.\n\n\n## How does it work?\n\n**Yawn** is just a thin wrapper on top of Hibernate queries. In order to power type-safe queries, **Yawn** generates objects representing the metadata of each\ntable and column related to a Hibernate entity annotated with `@YawnEntity`; so the migration can be completely unobtrusive and opt-in.\n\nThe generation is powered by [KSP](https://kotlinlang.org/docs/ksp-overview.html), and is composed by a set of `TableDef` (table definitions) that contain a set\nof `ColumnDef` (column definitions). The generate code contains the type information as generics that is necessary to make the queries safe. For example, it\nforces you to query columns that belong (or were joined from) to the table being queried; and it enforces the type of the values provided for comparison.\n\n## Contributing\n\nIf you like Yawn, give us a star to help the project!\n\nHave you found a bug or have a suggestion? Open an [issue](https://github.com/Faire/yawn/issues) and we will take a\nlook at it as soon as possible.\n\nDo you want to contribute with a PR? Make sure to read our [Contributing Guide](/CONTRIBUTING.md)!\n\n\n[yawn-gradle-plugin-readme]: /yawn-gradle-plugin/README.md\n[yawn-test-query-factory]: /yawn-database-test/src/main/kotlin/com/faire/yawn/setup/hibernate/YawnTestQueryFactory.kt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaire%2Fyawn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaire%2Fyawn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaire%2Fyawn/lists"}