├── .all-contributorsrc ├── .github ├── CODEOWNERS ├── dependabot.yml ├── project.yml └── workflows │ ├── build.yml │ ├── pre-release.yml │ ├── quarkus-snapshot.yaml │ ├── release-perform.yml │ └── release-prepare.yml ├── .gitignore ├── LICENSE ├── README.md ├── deployment ├── pom.xml └── src │ ├── main │ └── java │ │ └── io │ │ └── quarkiverse │ │ └── jdbc │ │ └── sqlite │ │ └── deployment │ │ ├── JDBCSqliteProcessor.java │ │ ├── SqliteHibernateProcessor.java │ │ └── SqliteJDBCReflections.java │ └── test │ └── java │ └── io │ └── quarkiverse │ └── jdbc │ └── sqlite │ └── test │ ├── JDBCSqliteDevModeTest.java │ └── JDBCSqliteTest.java ├── docs ├── antora.yml ├── modules │ └── ROOT │ │ ├── assets │ │ └── images │ │ │ └── .keepme │ │ ├── examples │ │ └── .keepme │ │ ├── nav.adoc │ │ └── pages │ │ ├── datasource.adoc │ │ ├── includes │ │ └── attributes.adoc │ │ └── index.adoc ├── pom.xml └── templates │ └── includes │ └── attributes.adoc ├── integration-tests ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── quarkiverse │ │ │ └── jdbc │ │ │ └── sqlite │ │ │ └── it │ │ │ ├── HibernateTestEntity.java │ │ │ ├── JDBCSqliteResource.java │ │ │ └── jpa │ │ │ ├── Address.java │ │ │ ├── Animal.java │ │ │ ├── Customer.java │ │ │ ├── Human.java │ │ │ ├── JPAFunctionalityTestEndpoint.java │ │ │ ├── JPATestReflectionEndpoint.java │ │ │ ├── NotAnEntityNotReferenced.java │ │ │ ├── Person.java │ │ │ ├── SequencedAddress.java │ │ │ ├── Status.java │ │ │ └── WorkAddress.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── io │ └── quarkiverse │ └── jdbc │ └── sqlite │ └── jdbc │ └── sqlite │ └── it │ ├── JDBCSqliteResourceIT.java │ ├── JDBCSqliteResourceTest.java │ └── jpa │ ├── JPAFunctionalityTest.java │ ├── JPAReflectionInGraalITCase.java │ └── OverrideJdbcUrlBuildTimeConfigSource.java ├── pom.xml └── runtime ├── pom.xml └── src └── main ├── java └── io │ └── quarkiverse │ └── jdbc │ └── sqlite │ └── runtime │ ├── SQLiteConstants.java │ └── SqliteAgroalConnectionConfigurer.java └── resources └── META-INF └── quarkus-extension.yaml /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "README.md" 4 | ], 5 | "imageSize": 100, 6 | "commit": false, 7 | "contributors": [ 8 | { 9 | "login": "alexeysharandin", 10 | "name": "Alexey Sharandin", 11 | "avatar_url": "https://avatars.githubusercontent.com/u/41162858?v=4", 12 | "profile": "https://www.linkedin.com/in/sharandin/", 13 | "contributions": [ 14 | "code", 15 | "maintenance" 16 | ] 17 | } 18 | ], 19 | "contributorsPerLine": 7, 20 | "projectName": "quarkus-jdbc-sqlite", 21 | "projectOwner": "quarkiverse", 22 | "repoType": "github", 23 | "repoHost": "https://github.com", 24 | "skipCi": true 25 | } 26 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lines starting with '#' are comments. 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | # More details are here: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners 5 | 6 | # The '*' pattern is global owners. 7 | 8 | # Order is important. The last matching pattern has the most precedence. 9 | # The folders are ordered as follows: 10 | 11 | # In each subsection folders are ordered first by depth, then alphabetically. 12 | # This should make it easy to add new rules without breaking existing ones. 13 | 14 | * @quarkiverse/quarkiverse-jdbc-sqlite 15 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "maven" 9 | directory: "/" 10 | schedule: 11 | interval: "daily" 12 | ignore: 13 | - dependency-name: "org.apache.maven.plugins:maven-compiler-plugin" 14 | -------------------------------------------------------------------------------- /.github/project.yml: -------------------------------------------------------------------------------- 1 | release: 2 | current-version: "3.0.11" 3 | next-version: "999-SNAPSHOT" 4 | 5 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" 7 | paths-ignore: 8 | - '.gitignore' 9 | - 'CODEOWNERS' 10 | - 'LICENSE' 11 | - '*.md' 12 | - '*.adoc' 13 | - '*.txt' 14 | - '.all-contributorsrc' 15 | pull_request: 16 | paths-ignore: 17 | - '.gitignore' 18 | - 'CODEOWNERS' 19 | - 'LICENSE' 20 | - '*.md' 21 | - '*.adoc' 22 | - '*.txt' 23 | - '.all-contributorsrc' 24 | 25 | jobs: 26 | build: 27 | name: Build on ${{ matrix.os }} 28 | strategy: 29 | matrix: 30 | # os: [windows-latest, macos-latest, ubuntu-latest] 31 | os: [ubuntu-latest] 32 | # fail-fast: false 33 | runs-on: ${{ matrix.os }} 34 | steps: 35 | - name: Prepare git 36 | run: git config --global core.autocrlf false 37 | if: startsWith(matrix.os, 'windows') 38 | 39 | - uses: actions/checkout@v2 40 | - name: Set up JDK 17 41 | uses: actions/setup-java@v2 42 | with: 43 | distribution: temurin 44 | java-version: 17 45 | cache: 'maven' 46 | 47 | - name: Build with Maven 48 | run: mvn -B formatter:validate verify --file pom.xml 49 | -------------------------------------------------------------------------------- /.github/workflows/pre-release.yml: -------------------------------------------------------------------------------- 1 | name: Quarkiverse Pre Release 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - '.github/project.yml' 7 | 8 | concurrency: 9 | group: ${{ github.workflow }}-${{ github.ref }} 10 | cancel-in-progress: true 11 | 12 | jobs: 13 | pre-release: 14 | name: Pre-Release 15 | uses: quarkiverse/.github/.github/workflows/pre-release.yml@main 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /.github/workflows/quarkus-snapshot.yaml: -------------------------------------------------------------------------------- 1 | name: "Quarkus ecosystem CI" 2 | on: 3 | workflow_dispatch: 4 | watch: 5 | types: [started] 6 | 7 | # For this CI to work, ECOSYSTEM_CI_TOKEN needs to contain a GitHub with rights to close the Quarkus issue that the user/bot has opened, 8 | # while 'ECOSYSTEM_CI_REPO_PATH' needs to be set to the corresponding path in the 'quarkusio/quarkus-ecosystem-ci' repository 9 | 10 | env: 11 | ECOSYSTEM_CI_REPO: quarkusio/quarkus-ecosystem-ci 12 | ECOSYSTEM_CI_REPO_FILE: context.yaml 13 | JAVA_VERSION: 17 14 | 15 | ######################### 16 | # Repo specific setting # 17 | ######################### 18 | 19 | ECOSYSTEM_CI_REPO_PATH: quarkiverse-jdbc-sqlite 20 | 21 | jobs: 22 | build: 23 | name: "Build against latest Quarkus snapshot" 24 | runs-on: ubuntu-latest 25 | # Allow to manually launch the ecosystem CI in addition to the bots 26 | if: github.actor == 'quarkusbot' || github.actor == 'quarkiversebot' || github.actor == '' 27 | 28 | steps: 29 | - name: Set up Java 30 | uses: actions/setup-java@v2 31 | with: 32 | distribution: temurin 33 | java-version: ${{ env.JAVA_VERSION }} 34 | 35 | - name: Checkout repo 36 | uses: actions/checkout@v2 37 | with: 38 | path: current-repo 39 | 40 | - name: Checkout Ecosystem 41 | uses: actions/checkout@v2 42 | with: 43 | repository: ${{ env.ECOSYSTEM_CI_REPO }} 44 | path: ecosystem-ci 45 | 46 | - name: Setup and Run Tests 47 | run: ./ecosystem-ci/setup-and-test 48 | env: 49 | ECOSYSTEM_CI_TOKEN: ${{ secrets.ECOSYSTEM_CI_TOKEN }} 50 | -------------------------------------------------------------------------------- /.github/workflows/release-perform.yml: -------------------------------------------------------------------------------- 1 | name: Quarkiverse Prepare Release 2 | 3 | on: 4 | pull_request: 5 | types: [ closed ] 6 | paths: 7 | - '.github/project.yml' 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.ref }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | prepare-release: 15 | name: Prepare Release 16 | if: ${{ github.event.pull_request.merged == true}} 17 | uses: quarkiverse/.github/.github/workflows/prepare-release.yml@main 18 | secrets: inherit 19 | -------------------------------------------------------------------------------- /.github/workflows/release-prepare.yml: -------------------------------------------------------------------------------- 1 | name: Quarkiverse Perform Release 2 | run-name: Perform ${{github.event.inputs.tag || github.ref_name}} Release 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | workflow_dispatch: 8 | inputs: 9 | tag: 10 | description: 'Tag to release' 11 | required: true 12 | 13 | permissions: 14 | attestations: write 15 | id-token: write 16 | contents: read 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | perform-release: 24 | name: Perform Release 25 | uses: quarkiverse/.github/.github/workflows/perform-release.yml@main 26 | secrets: inherit 27 | with: 28 | version: ${{github.event.inputs.tag || github.ref_name}} 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | # Eclipse 26 | .project 27 | .classpath 28 | .settings/ 29 | bin/ 30 | 31 | # IntelliJ 32 | .idea 33 | *.ipr 34 | *.iml 35 | *.iws 36 | 37 | # NetBeans 38 | nb-configuration.xml 39 | 40 | # Visual Studio Code 41 | .vscode 42 | .factorypath 43 | 44 | # OSX 45 | .DS_Store 46 | 47 | # Vim 48 | *.swp 49 | *.swo 50 | 51 | # patch 52 | *.orig 53 | *.rej 54 | 55 | # Gradle 56 | .gradle/ 57 | build/ 58 | 59 | # Maven 60 | target/ 61 | pom.xml.tag 62 | pom.xml.releaseBackup 63 | pom.xml.versionsBackup 64 | release.properties -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Quarkus JDBC SQLite extension 2 | 3 | 4 | [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) 5 | 6 | [![Build](https://github.com/quarkiverse/quarkus-jdbc-sqlite/workflows/Build/badge.svg)](https://github.com/quarkiverse/quarkus-jdbc-sqlite/actions?query=workflow%3ABuild) 7 | [![Maven Central](https://img.shields.io/maven-central/v/io.quarkiverse.jdbc/quarkus-jdbc-sqlite.svg?label=Maven%20Central&style=flat-square)](https://search.maven.org/artifact/io.quarkiverse.jdbc/quarkus-jdbc-sqlite) 8 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0) 9 | 10 | Quarkus JDBC SQLite is a Quarkus extension for the SQLite Embedded database. 11 | 12 | 13 | ## User Documentation 14 | 15 | https://docs.quarkiverse.io/quarkus-jdbc-sqlite/dev/index.html 16 | 17 | ## Contributors ✨ 18 | 19 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |

Alexey Sharandin

💻 🚧
29 | 30 | 31 | 32 | 33 | 34 | 35 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! 36 | -------------------------------------------------------------------------------- /deployment/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | io.quarkiverse.jdbc 6 | quarkus-jdbc-sqlite-parent 7 | 999-SNAPSHOT 8 | 9 | quarkus-jdbc-sqlite-deployment 10 | Quarkus - JDBC SQLite - Deployment 11 | 12 | 13 | io.quarkus 14 | quarkus-arc-deployment 15 | 16 | 17 | io.quarkus 18 | quarkus-hibernate-orm-deployment-spi 19 | 20 | 21 | io.quarkus 22 | quarkus-datasource-deployment-spi 23 | 24 | 25 | io.quarkus 26 | quarkus-agroal-spi 27 | 28 | 29 | io.quarkiverse.jdbc 30 | quarkus-jdbc-sqlite 31 | ${project.version} 32 | 33 | 34 | io.quarkus 35 | quarkus-junit5-internal 36 | test 37 | 38 | 39 | 40 | 41 | 42 | maven-compiler-plugin 43 | 44 | 45 | 46 | io.quarkus 47 | quarkus-extension-processor 48 | ${quarkus.version} 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /deployment/src/main/java/io/quarkiverse/jdbc/sqlite/deployment/JDBCSqliteProcessor.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.deployment; 2 | 3 | import static io.quarkiverse.jdbc.sqlite.runtime.SQLiteConstants.DB_KIND; 4 | 5 | import org.sqlite.JDBC; 6 | import org.sqlite.SQLiteDataSource; 7 | 8 | import io.quarkiverse.jdbc.sqlite.runtime.SqliteAgroalConnectionConfigurer; 9 | import io.quarkus.agroal.spi.JdbcDriverBuildItem; 10 | import io.quarkus.arc.deployment.AdditionalBeanBuildItem; 11 | import io.quarkus.arc.processor.BuiltinScope; 12 | import io.quarkus.datasource.deployment.spi.DefaultDataSourceDbKindBuildItem; 13 | import io.quarkus.datasource.deployment.spi.DevServicesDatasourceConfigurationHandlerBuildItem; 14 | import io.quarkus.deployment.Capabilities; 15 | import io.quarkus.deployment.Capability; 16 | import io.quarkus.deployment.annotations.BuildProducer; 17 | import io.quarkus.deployment.annotations.BuildStep; 18 | import io.quarkus.deployment.builditem.FeatureBuildItem; 19 | import io.quarkus.deployment.builditem.SslNativeConfigBuildItem; 20 | 21 | /** 22 | * Deploy extension to Quarkus framework 23 | * 24 | */ 25 | @SuppressWarnings("unused") 26 | class JDBCSqliteProcessor { 27 | 28 | private static final String FEATURE = "jdbc-sqlite"; 29 | 30 | static final String DRIVER_NAME = JDBC.class.getName(); 31 | private static final String DATA_SOURCE_NAME = SQLiteDataSource.class.getName(); 32 | 33 | @BuildStep 34 | FeatureBuildItem feature() { 35 | return new FeatureBuildItem(FEATURE); 36 | } 37 | 38 | @BuildStep 39 | void registerDriver(BuildProducer jdbcDriver, 40 | SslNativeConfigBuildItem sslNativeConfigBuildItem) { 41 | 42 | jdbcDriver.produce( 43 | new JdbcDriverBuildItem( 44 | DB_KIND, 45 | DRIVER_NAME, 46 | DATA_SOURCE_NAME)); 47 | } 48 | 49 | @BuildStep 50 | DevServicesDatasourceConfigurationHandlerBuildItem devDbHandler() { 51 | return DevServicesDatasourceConfigurationHandlerBuildItem.jdbc(DB_KIND); 52 | } 53 | 54 | @BuildStep 55 | void configureAgroalConnection(BuildProducer additionalBeans, 56 | Capabilities capabilities) { 57 | if (capabilities.isPresent(Capability.AGROAL)) { 58 | additionalBeans.produce(new AdditionalBeanBuildItem.Builder().addBeanClass(SqliteAgroalConnectionConfigurer.class) 59 | .setDefaultScope(BuiltinScope.APPLICATION.getName()) 60 | .setUnremovable() 61 | .build()); 62 | } 63 | } 64 | 65 | @BuildStep 66 | void registerDefaultDbType(BuildProducer dbKind) { 67 | dbKind.produce(new DefaultDataSourceDbKindBuildItem(DB_KIND)); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /deployment/src/main/java/io/quarkiverse/jdbc/sqlite/deployment/SqliteHibernateProcessor.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.deployment; 2 | 3 | import org.hibernate.community.dialect.SQLiteDialect; 4 | 5 | import io.quarkiverse.jdbc.sqlite.runtime.SQLiteConstants; 6 | import io.quarkus.deployment.annotations.BuildProducer; 7 | import io.quarkus.deployment.annotations.BuildStep; 8 | import io.quarkus.hibernate.orm.deployment.spi.DatabaseKindDialectBuildItem; 9 | 10 | public class SqliteHibernateProcessor { 11 | 12 | @BuildStep 13 | void processHibernate( 14 | BuildProducer producer) { 15 | producer.produce( 16 | DatabaseKindDialectBuildItem.forThirdPartyDialect(SQLiteConstants.DB_KIND, SQLiteDialect.class.getName())); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /deployment/src/main/java/io/quarkiverse/jdbc/sqlite/deployment/SqliteJDBCReflections.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.deployment; 2 | 3 | import static io.quarkiverse.jdbc.sqlite.deployment.JDBCSqliteProcessor.DRIVER_NAME; 4 | 5 | import io.quarkus.deployment.annotations.BuildProducer; 6 | import io.quarkus.deployment.annotations.BuildStep; 7 | import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; 8 | 9 | /** 10 | * Registers the {@code org.sqlite.JDBC} so that it can be loaded 11 | * by reflection, as commonly expected. 12 | */ 13 | 14 | @SuppressWarnings("unused") 15 | public class SqliteJDBCReflections { 16 | @BuildStep 17 | void build(BuildProducer reflectiveClass) { 18 | //Not strictly necessary when using Agroal, as it also registers 19 | //any JDBC driver being configured explicitly through its configuration. 20 | //We register it for the sake of people not using Agroal. 21 | reflectiveClass.produce(ReflectiveClassBuildItem.builder(DRIVER_NAME).build()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /deployment/src/test/java/io/quarkiverse/jdbc/sqlite/test/JDBCSqliteDevModeTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.test; 2 | 3 | public class JDBCSqliteDevModeTest { 4 | 5 | /* 6 | * // Start hot reload (DevMode) test with your extension loaded 7 | * 8 | * @RegisterExtension 9 | * static final QuarkusDevModeTest devModeTest = new QuarkusDevModeTest() 10 | * .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); 11 | * 12 | * @Test 13 | * public void writeYourOwnDevModeTest() { 14 | * // Write your dev mode tests here - see the testing extension guide 15 | * https://quarkus.io/guides/writing-extensions#testing-hot-reload for more information 16 | * Assertions.assertTrue(true, "Add dev mode assertions to " + getClass().getName()); 17 | * } 18 | */ 19 | } 20 | -------------------------------------------------------------------------------- /deployment/src/test/java/io/quarkiverse/jdbc/sqlite/test/JDBCSqliteTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.test; 2 | 3 | public class JDBCSqliteTest { 4 | 5 | // Start unit test with your extension loaded 6 | /* 7 | * @RegisterExtension 8 | * static final QuarkusUnitTest unitTest = new QuarkusUnitTest() 9 | * .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); 10 | * 11 | * @Test 12 | * public void writeYourOwnUnitTest() { 13 | * // Write your unit tests here - see the testing extension guide 14 | * https://quarkus.io/guides/writing-extensions#testing-extensions for more information 15 | * Assertions.assertTrue(true, "Add some assertions to " + getClass().getName()); 16 | * } 17 | */ 18 | } 19 | -------------------------------------------------------------------------------- /docs/antora.yml: -------------------------------------------------------------------------------- 1 | name: quarkus-jdbc-sqlite 2 | title: JDBC Sqlite 3 | version: dev 4 | nav: 5 | - modules/ROOT/nav.adoc 6 | -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/.keepme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkiverse/quarkus-jdbc-sqlite/8ed98fd171a4382017d8d7db016de822b950337f/docs/modules/ROOT/assets/images/.keepme -------------------------------------------------------------------------------- /docs/modules/ROOT/examples/.keepme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkiverse/quarkus-jdbc-sqlite/8ed98fd171a4382017d8d7db016de822b950337f/docs/modules/ROOT/examples/.keepme -------------------------------------------------------------------------------- /docs/modules/ROOT/nav.adoc: -------------------------------------------------------------------------------- 1 | * xref:index.adoc[Introduction] 2 | * xref:datasource.adoc[Configuring the datasource] 3 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/datasource.adoc: -------------------------------------------------------------------------------- 1 | = Configuring the datasource 2 | 3 | == Datasource 4 | 5 | You can find all the information about how to configure a datasource in Quarkus in https://quarkus.io/guides/datasource[the official Quarkus documentation]. 6 | 7 | The `db-kind` used by this extension is `sqlite` so a configuration defining a default SQLite datasource looks like: 8 | 9 | [source,properties] 10 | ---- 11 | quarkus.datasource.db-kind=sqlite 12 | quarkus.datasource.jdbc.url=... <1> 13 | ---- 14 | <1> See below for SQLite JDBC URLs. 15 | 16 | == JDBC URL 17 | 18 | SQLite only runs as an embedded database. 19 | 20 | You can specify connection details using the JDBC URL, or use the defaults. 21 | 22 | An SQLite JDBC URL looks like the following: 23 | 24 | 25 | `jdbc:sqlite:[path]/[name][?key=value...]` 26 | 27 | Example:: `jdbc:sqlite:/home/user/mydatabase.db` 28 | 29 | SQLite also supports in-memory database management, which does not create any database files. 30 | To use an in-memory database, specify the following JDBC URL: 31 | 32 | `jdbc:sqlite::memory:` 33 | 34 | The https://www.sqlite.org/uri.html[official documentation] and https://www.sqlite.org/c3ref/open.html#urifilenameexamples[URI Examples] go into more details and list optional parameters as well. 35 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/includes/attributes.adoc: -------------------------------------------------------------------------------- 1 | :project-version: 3.0.11 2 | 3 | :examples-dir: ./../examples/ -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/index.adoc: -------------------------------------------------------------------------------- 1 | = Quarkus JDBC Sqlite 2 | :extension-status: preview 3 | 4 | Quarkus JDBC SQLite is a Quarkus extention for the https://www.sqlite.org/[SQLite database]. 5 | 6 | == Installation 7 | 8 | If you want to use this extension, you need to add the `io.quarkiverse.jdbc:quarkus-jdbc-sqlite` extension first. 9 | 10 | For instance, in your `pom.xml` file, add the following dependency: 11 | 12 | [source,xml] 13 | ---- 14 | 15 | io.quarkiverse.jdbc 16 | quarkus-jdbc-sqlite 17 | 18 | ---- 19 | 20 | == Configuration 21 | 22 | You can find more information about how to configure the datasource xref:datasource.adoc[here]. 23 | -------------------------------------------------------------------------------- /docs/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | io.quarkiverse.jdbc 6 | quarkus-jdbc-sqlite-parent 7 | 999-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | quarkus-jdbc-sqlite-docs 12 | Quarkus - JDBC SQLite - Documentation 13 | 14 | 15 | 16 | 17 | io.quarkiverse.jdbc 18 | quarkus-jdbc-sqlite-deployment 19 | ${project.version} 20 | 21 | 22 | 23 | 24 | modules/ROOT/examples 25 | 26 | 27 | io.quarkus 28 | quarkus-maven-plugin 29 | 30 | 31 | 32 | build 33 | 34 | 35 | 36 | 37 | 38 | it.ozimov 39 | yaml-properties-maven-plugin 40 | 41 | 42 | initialize 43 | 44 | read-project-properties 45 | 46 | 47 | 48 | ${project.basedir}/../.github/project.yml 49 | 50 | 51 | 52 | 53 | 54 | 55 | io.quarkus 56 | quarkus-config-doc-maven-plugin 57 | true 58 | 59 | ${project.basedir}/modules/ROOT/pages/includes/ 60 | 61 | 62 | 63 | maven-resources-plugin 64 | 65 | 66 | copy-resources 67 | generate-resources 68 | 69 | copy-resources 70 | 71 | 72 | ${project.basedir}/modules/ROOT/pages/includes/ 73 | 74 | 75 | ${project.basedir}/templates/includes 76 | attributes.adoc 77 | true 78 | 79 | 80 | 81 | 82 | 83 | copy-images 84 | prepare-package 85 | 86 | copy-resources 87 | 88 | 89 | ${project.build.directory}/generated-docs/_images/ 90 | 91 | 92 | ${project.basedir}/modules/ROOT/assets/images/ 93 | false 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | org.asciidoctor 102 | asciidoctor-maven-plugin 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /docs/templates/includes/attributes.adoc: -------------------------------------------------------------------------------- 1 | :project-version: ${release.current-version} 2 | 3 | :examples-dir: ./../examples/ -------------------------------------------------------------------------------- /integration-tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | io.quarkiverse.jdbc 6 | quarkus-jdbc-sqlite-parent 7 | 999-SNAPSHOT 8 | 9 | quarkus-jdbc-sqlite-integration-tests 10 | Quarkus - JDBC SQLite - Integration Tests 11 | 12 | 13 | io.quarkus 14 | quarkus-resteasy 15 | 16 | 17 | io.quarkiverse.jdbc 18 | quarkus-jdbc-sqlite 19 | ${project.version} 20 | 21 | 22 | io.quarkus 23 | quarkus-agroal 24 | 25 | 26 | io.quarkus 27 | quarkus-undertow 28 | 29 | 30 | 31 | io.quarkus 32 | quarkus-hibernate-orm 33 | 34 | 35 | io.quarkus 36 | quarkus-hibernate-orm-panache 37 | 38 | 39 | io.quarkus 40 | quarkus-junit5 41 | test 42 | 43 | 44 | io.rest-assured 45 | rest-assured 46 | test 47 | 48 | 49 | 50 | 51 | 52 | io.quarkus 53 | quarkus-maven-plugin 54 | 55 | 56 | 57 | build 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | native-image 67 | 68 | 69 | native 70 | 71 | 72 | 73 | 74 | 75 | maven-surefire-plugin 76 | 77 | 78 | ${native.surefire.skip} 79 | 80 | 81 | 82 | maven-failsafe-plugin 83 | 84 | 85 | 86 | integration-test 87 | verify 88 | 89 | 90 | 91 | ${project.build.directory}/${project.build.finalName}-runner 92 | org.jboss.logmanager.LogManager 93 | 94 | ${maven.home} 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | native 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/HibernateTestEntity.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it; 2 | 3 | import jakarta.persistence.Entity; 4 | 5 | import io.quarkus.hibernate.orm.panache.PanacheEntity; 6 | 7 | @SuppressWarnings("unused") 8 | @Entity 9 | public class HibernateTestEntity extends PanacheEntity { 10 | private String name; 11 | 12 | public String getName() { 13 | return name; 14 | } 15 | 16 | public void setName(String name) { 17 | this.name = name; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/JDBCSqliteResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package io.quarkiverse.jdbc.sqlite.it; 18 | 19 | import java.sql.*; 20 | 21 | import jakarta.enterprise.context.ApplicationScoped; 22 | import jakarta.inject.Inject; 23 | import jakarta.ws.rs.GET; 24 | import jakarta.ws.rs.Path; 25 | 26 | import io.agroal.api.AgroalDataSource; 27 | 28 | /** 29 | * Basic integration test for quarkus-jdbc-sqlite 30 | * 31 | */ 32 | 33 | @SuppressWarnings("unused") 34 | @Path("/JDBC-Sqlite") 35 | @ApplicationScoped 36 | public class JDBCSqliteResource { 37 | // add some rest methods here 38 | @Inject 39 | AgroalDataSource ds; 40 | 41 | @GET 42 | @Path("Agoral") 43 | public String testAgoral() throws SQLException { 44 | String result; 45 | try (Connection connection = ds.getConnection()) { 46 | result = test(connection); 47 | } 48 | return result; 49 | } 50 | 51 | @GET 52 | @Path("Connection") 53 | public String connection() throws SQLException { 54 | String result; 55 | try (Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:")) { 56 | result = test(connection); 57 | } 58 | return result; 59 | } 60 | 61 | private String test(Connection connection) throws SQLException { 62 | StringBuilder result = new StringBuilder(); 63 | try (Statement statement = connection.createStatement()) { 64 | statement.setQueryTimeout(30); // set timeout to 30 sec. 65 | 66 | statement.executeUpdate("drop table if exists xperson"); 67 | statement.executeUpdate("create table xperson (id integer, name string)"); 68 | statement.executeUpdate("insert into xperson values(1, 'leo')"); 69 | statement.executeUpdate("insert into xperson values(2, 'yui')"); 70 | try (ResultSet rs = statement.executeQuery("select * from xperson")) { 71 | while (rs.next()) { 72 | result.append(rs.getInt("id")).append("/").append(rs.getString("name")).append("/"); 73 | } 74 | } 75 | } 76 | return result.toString(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/Address.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | import jakarta.persistence.Embeddable; 4 | 5 | /** 6 | * This is an enmarked @Embeddable class. 7 | * Let's see if just being referenced by the main entity is enough to be detected. 8 | * 9 | * @author Emmanuel Bernard emmanuel@hibernate.org 10 | */ 11 | //FIXME : this used to be non-annotated explicitly for testing purposes 12 | // added the annotation as it's illegal according to the ORM metadata validation 13 | @SuppressWarnings("unused") 14 | @Embeddable 15 | public class Address { 16 | private String street1; 17 | private String street2; 18 | private String zipCode; 19 | 20 | public String getStreet1() { 21 | return street1; 22 | } 23 | 24 | public void setStreet1(String street1) { 25 | this.street1 = street1; 26 | } 27 | 28 | public String getStreet2() { 29 | return street2; 30 | } 31 | 32 | public void setStreet2(String street2) { 33 | this.street2 = street2; 34 | } 35 | 36 | public String getZipCode() { 37 | return zipCode; 38 | } 39 | 40 | public void setZipCode(String zipCode) { 41 | this.zipCode = zipCode; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/Animal.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | /** 4 | * @author Emmanuel Bernard emmanuel@hibernate.org 5 | */ 6 | @SuppressWarnings("unused") 7 | public class Animal { 8 | private double weight; 9 | 10 | public double getWeight() { 11 | return weight; 12 | } 13 | 14 | public void setWeight(double weight) { 15 | this.weight = weight; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/Customer.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | import jakarta.persistence.Embedded; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Id; 6 | 7 | /** 8 | * Used to test reflection references for JPA 9 | * 10 | * @author Emmanuel Bernard emmanuel@hibernate.org 11 | */ 12 | @SuppressWarnings("unused") 13 | @Entity 14 | public class Customer extends Human { 15 | @Id 16 | // no getter explicitly to test field only reflective access 17 | private Long id; 18 | 19 | private Address address; 20 | private WorkAddress workAddress; 21 | 22 | private String name; 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | // Address is referenced but not marked as @Embeddable 33 | @Embedded 34 | public Address getAddress() { 35 | return address; 36 | } 37 | 38 | public WorkAddress getWorkAddress() { 39 | return workAddress; 40 | } 41 | 42 | public void setWorkAddress(WorkAddress workAddress) { 43 | this.workAddress = workAddress; 44 | } 45 | 46 | public void setAddress(Address address) { 47 | this.address = address; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/Human.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | import jakarta.persistence.MappedSuperclass; 4 | 5 | /** 6 | * Mapped superclass test 7 | * 8 | * @author Emmanuel Bernard emmanuel@hibernate.org 9 | */ 10 | @SuppressWarnings("unused") 11 | @MappedSuperclass 12 | public class Human extends Animal { 13 | private String name; 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public void setName(String name) { 20 | this.name = name; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/JPAFunctionalityTestEndpoint.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.List; 6 | import java.util.UUID; 7 | 8 | import jakarta.inject.Inject; 9 | import jakarta.persistence.EntityManager; 10 | import jakarta.persistence.EntityManagerFactory; 11 | import jakarta.persistence.EntityTransaction; 12 | import jakarta.persistence.TypedQuery; 13 | import jakarta.persistence.criteria.CriteriaBuilder; 14 | import jakarta.persistence.criteria.CriteriaQuery; 15 | import jakarta.persistence.criteria.Root; 16 | import jakarta.servlet.annotation.WebServlet; 17 | import jakarta.servlet.http.HttpServlet; 18 | import jakarta.servlet.http.HttpServletRequest; 19 | import jakarta.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * Various tests covering JPA functionality. All tests should work in both standard JVM and in native mode. 23 | */ 24 | @WebServlet(name = "JPATestBootstrapEndpoint", urlPatterns = "/jpa/testfunctionality") 25 | public class JPAFunctionalityTestEndpoint extends HttpServlet { 26 | 27 | @Inject 28 | EntityManagerFactory entityManagerFactory; 29 | 30 | @Override 31 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { 32 | try { 33 | doStuffWithHibernate(entityManagerFactory); 34 | } catch (Exception e) { 35 | reportException("An error occurred while performing Hibernate operations", e, resp); 36 | } 37 | resp.getWriter().write("OK"); 38 | } 39 | 40 | /** 41 | * Lists the various operations we want to test for: 42 | */ 43 | private static void doStuffWithHibernate(EntityManagerFactory entityManagerFactory) { 44 | 45 | //Cleanup any existing data: 46 | deleteAllPerson(entityManagerFactory); 47 | 48 | //Store some well known Person instances we can then test on: 49 | storeTestPersons(entityManagerFactory); 50 | 51 | //Load all persons and run some checks on the query results: 52 | verifyListOfExistingPersons(entityManagerFactory); 53 | 54 | //Try a JPA named query: 55 | verifyJPANamedQuery(entityManagerFactory); 56 | 57 | deleteAllPerson(entityManagerFactory); 58 | 59 | } 60 | 61 | private static void verifyJPANamedQuery(final EntityManagerFactory emf) { 62 | EntityManager em = emf.createEntityManager(); 63 | EntityTransaction transaction = em.getTransaction(); 64 | transaction.begin(); 65 | TypedQuery typedQuery = em.createNamedQuery( 66 | "get_person_by_name", Person.class); 67 | typedQuery.setParameter("name", "Quarkus"); 68 | final Person singleResult = typedQuery.getSingleResult(); 69 | 70 | if (!singleResult.getName().equals("Quarkus")) { 71 | throw new RuntimeException("Wrong result from named JPA query"); 72 | } 73 | 74 | transaction.commit(); 75 | em.close(); 76 | } 77 | 78 | private static void verifyListOfExistingPersons(final EntityManagerFactory emf) { 79 | EntityManager em = emf.createEntityManager(); 80 | EntityTransaction transaction = em.getTransaction(); 81 | transaction.begin(); 82 | listExistingPersons(em); 83 | transaction.commit(); 84 | em.close(); 85 | } 86 | 87 | private static void storeTestPersons(final EntityManagerFactory emf) { 88 | EntityManager em = emf.createEntityManager(); 89 | EntityTransaction transaction = em.getTransaction(); 90 | transaction.begin(); 91 | persistNewPerson(em, "Gizmo"); 92 | persistNewPerson(em, "Quarkus"); 93 | persistNewPerson(em, "Hibernate ORM"); 94 | transaction.commit(); 95 | em.close(); 96 | } 97 | 98 | private static void deleteAllPerson(final EntityManagerFactory emf) { 99 | EntityManager em = emf.createEntityManager(); 100 | EntityTransaction transaction = em.getTransaction(); 101 | transaction.begin(); 102 | //em.createNativeQuery("Delete from myschema.Person").executeUpdate(); 103 | em.createNativeQuery("Delete from Person").executeUpdate(); 104 | transaction.commit(); 105 | em.close(); 106 | } 107 | 108 | private static void listExistingPersons(EntityManager em) { 109 | CriteriaBuilder cb = em.getCriteriaBuilder(); 110 | 111 | CriteriaQuery cq = cb.createQuery(Person.class); 112 | Root from = cq.from(Person.class); 113 | cq.select(from).orderBy(cb.asc(from.get("name"))); 114 | TypedQuery q = em.createQuery(cq); 115 | List allpersons = q.getResultList(); 116 | if (allpersons.size() != 3) { 117 | throw new RuntimeException("Incorrect number of results"); 118 | } 119 | if (!allpersons.get(0).getName().equals("Gizmo")) { 120 | throw new RuntimeException("Incorrect order of results"); 121 | } 122 | StringBuilder sb = new StringBuilder("list of stored Person names:\n\t"); 123 | for (Person p : allpersons) { 124 | p.describeFully(sb); 125 | sb.append("\n\t"); 126 | if (p.getStatus() != Status.LIVING) { 127 | throw new RuntimeException("Incorrect status " + p); 128 | } 129 | } 130 | sb.append("\nList complete.\n"); 131 | System.out.print(sb); 132 | } 133 | 134 | private static void persistNewPerson(EntityManager entityManager, String name) { 135 | Person person = new Person(); 136 | person.setName(name); 137 | person.setStatus(Status.LIVING); 138 | person.setAddress(new SequencedAddress("Street " + randomName())); 139 | entityManager.persist(person); 140 | } 141 | 142 | private static String randomName() { 143 | return UUID.randomUUID().toString(); 144 | } 145 | 146 | private void reportException(String errorMessage, final Exception e, final HttpServletResponse resp) throws IOException { 147 | final PrintWriter writer = resp.getWriter(); 148 | if (errorMessage != null) { 149 | writer.write(errorMessage); 150 | writer.write(" "); 151 | } 152 | writer.write(e.toString()); 153 | writer.append("\n\t"); 154 | e.printStackTrace(writer); 155 | writer.append("\n\t"); 156 | } 157 | 158 | } 159 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/JPATestReflectionEndpoint.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.lang.reflect.Field; 6 | import java.lang.reflect.Method; 7 | 8 | import jakarta.servlet.annotation.WebServlet; 9 | import jakarta.servlet.http.HttpServlet; 10 | import jakarta.servlet.http.HttpServletRequest; 11 | import jakarta.servlet.http.HttpServletResponse; 12 | 13 | /** 14 | * Various tests for the JPA integration. 15 | * WARNING: these tests will ONLY pass in native mode, as it also verifies reflection non-functionality. 16 | */ 17 | @WebServlet(name = "JPATestReflectionEndpoint", urlPatterns = "/jpa/testreflection") 18 | public class JPATestReflectionEndpoint extends HttpServlet { 19 | 20 | @Override 21 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { 22 | makeSureNonEntityAreDCE(resp); 23 | makeSureEntitiesAreAccessibleViaReflection(resp); 24 | makeSureNonAnnotatedEmbeddableAreAccessibleViaReflection(resp); 25 | makeSureAnnotatedEmbeddableAreAccessibleViaReflection(resp); 26 | String packageName = this.getClass().getPackage().getName(); 27 | makeSureClassAreAccessibleViaReflection(packageName + ".Human", "Unable to enlist @MappedSuperclass", resp); 28 | makeSureClassAreAccessibleViaReflection(packageName + ".Animal", "Unable to enlist entity superclass", resp); 29 | resp.getWriter().write("OK"); 30 | } 31 | 32 | private void makeSureClassAreAccessibleViaReflection(String className, String errorMessage, HttpServletResponse resp) 33 | throws IOException { 34 | try { 35 | className = getTrickedClassName(className); 36 | 37 | Class custClass = Class.forName(className); 38 | Object instance = custClass.getDeclaredConstructor().newInstance(); 39 | } catch (Exception e) { 40 | reportException(errorMessage, e, resp); 41 | } 42 | } 43 | 44 | private void makeSureEntitiesAreAccessibleViaReflection(HttpServletResponse resp) throws IOException { 45 | try { 46 | String className = getTrickedClassName(Customer.class.getName()); 47 | 48 | Class custClass = Class.forName(className); 49 | Object instance = custClass.getDeclaredConstructor().newInstance(); 50 | Field id = custClass.getDeclaredField("id"); 51 | id.setAccessible(true); 52 | if (id.get(instance) != null) { 53 | resp.getWriter().write("id should be reachable and null"); 54 | } 55 | Method setter = custClass.getDeclaredMethod("setName", String.class); 56 | Method getter = custClass.getDeclaredMethod("getName"); 57 | setter.invoke(instance, "Emmanuel"); 58 | if (!"Emmanuel".equals(getter.invoke(instance))) { 59 | resp.getWriter().write("getter / setter should be reachable and usable"); 60 | } 61 | } catch (Exception e) { 62 | reportException(e, resp); 63 | } 64 | } 65 | 66 | private void makeSureAnnotatedEmbeddableAreAccessibleViaReflection(HttpServletResponse resp) throws IOException { 67 | try { 68 | String className = getTrickedClassName(WorkAddress.class.getName()); 69 | 70 | Class custClass = Class.forName(className); 71 | Object instance = custClass.getDeclaredConstructor().newInstance(); 72 | Method setter = custClass.getDeclaredMethod("setCompany", String.class); 73 | Method getter = custClass.getDeclaredMethod("getCompany"); 74 | setter.invoke(instance, "Red Hat"); 75 | if (!"Red Hat".equals(getter.invoke(instance))) { 76 | resp.getWriter().write("@Embeddable embeddable should be reachable and usable"); 77 | } 78 | } catch (Exception e) { 79 | reportException(e, resp); 80 | } 81 | } 82 | 83 | private void makeSureNonAnnotatedEmbeddableAreAccessibleViaReflection(HttpServletResponse resp) throws IOException { 84 | try { 85 | String className = getTrickedClassName(Address.class.getName()); 86 | 87 | Class custClass = Class.forName(className); 88 | Object instance = custClass.getDeclaredConstructor().newInstance(); 89 | Method setter = custClass.getDeclaredMethod("setStreet1", String.class); 90 | Method getter = custClass.getDeclaredMethod("getStreet1"); 91 | setter.invoke(instance, "1 rue du General Leclerc"); 92 | if (!"1 rue du General Leclerc".equals(getter.invoke(instance))) { 93 | resp.getWriter().write("Non @Embeddable embeddable getter / setter should be reachable and usable"); 94 | } 95 | } catch (Exception e) { 96 | reportException(e, resp); 97 | } 98 | } 99 | 100 | private void makeSureNonEntityAreDCE(HttpServletResponse resp) { 101 | try { 102 | String className = getTrickedClassName(NotAnEntityNotReferenced.class.getName()); 103 | 104 | Class custClass = Class.forName(className); 105 | resp.getWriter().write("Should not be able to find a non referenced non entity class"); 106 | Object instance = custClass.getDeclaredConstructor().newInstance(); 107 | } catch (Exception e) { 108 | // Expected outcome 109 | } 110 | } 111 | 112 | /** 113 | * Trick SubstrateVM not to detect a simple use of Class.forname 114 | */ 115 | private String getTrickedClassName(String className) { 116 | className = className + " ITrickYou"; 117 | className = className.subSequence(0, className.indexOf(' ')).toString(); 118 | return className; 119 | } 120 | 121 | private void reportException(final Exception e, final HttpServletResponse resp) throws IOException { 122 | reportException(null, e, resp); 123 | } 124 | 125 | private void reportException(String errorMessage, final Exception e, final HttpServletResponse resp) throws IOException { 126 | final PrintWriter writer = resp.getWriter(); 127 | if (errorMessage != null) { 128 | writer.write(errorMessage); 129 | writer.write(" "); 130 | } 131 | writer.write(e.toString()); 132 | writer.append("\n\t"); 133 | e.printStackTrace(writer); 134 | writer.append("\n\t"); 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/NotAnEntityNotReferenced.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | /** 4 | * Should not be referenced by the code 5 | * So be dead code eliminated. 6 | * Used to test that entities get referenced but not non entities 7 | * 8 | * @author Emmanuel Bernard emmanuel@hibernate.org 9 | */ 10 | public class NotAnEntityNotReferenced { 11 | } 12 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/Person.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | import jakarta.persistence.CascadeType; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.FetchType; 6 | import jakarta.persistence.GeneratedValue; 7 | import jakarta.persistence.GenerationType; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.ManyToOne; 10 | import jakarta.persistence.NamedQuery; 11 | import jakarta.persistence.Table; 12 | 13 | @SuppressWarnings("unused") 14 | @Entity 15 | @Table /* (schema = "myschema") */ // Schemas not supported by sqllite driver 16 | @NamedQuery(name = "get_person_by_name", query = "select p from Person p where name = :name") 17 | public class Person { 18 | 19 | private long id; 20 | private String name; 21 | private SequencedAddress address; 22 | private Status status; 23 | 24 | public Person() { 25 | } 26 | 27 | public Person(long id, String name, SequencedAddress address) { 28 | this.id = id; 29 | this.name = name; 30 | this.address = address; 31 | } 32 | 33 | @Id 34 | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "personSeq") 35 | public long getId() { 36 | return id; 37 | } 38 | 39 | public void setId(long id) { 40 | this.id = id; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | 51 | @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) 52 | public SequencedAddress getAddress() { 53 | return address; 54 | } 55 | 56 | public void setAddress(SequencedAddress address) { 57 | this.address = address; 58 | } 59 | 60 | public Status getStatus() { 61 | return status; 62 | } 63 | 64 | public void setStatus(Status status) { 65 | this.status = status; 66 | } 67 | 68 | public void describeFully(StringBuilder sb) { 69 | sb.append("Person with id=").append(id).append(", name='").append(name).append("', status='").append(status) 70 | .append("', address { "); 71 | getAddress().describeFully(sb); 72 | sb.append(" }"); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/SequencedAddress.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | 8 | @SuppressWarnings("unused") 9 | @Entity 10 | public class SequencedAddress { 11 | 12 | private long id; 13 | private String street; 14 | 15 | public SequencedAddress() { 16 | } 17 | 18 | public SequencedAddress(String street) { 19 | this.street = street; 20 | } 21 | 22 | @Id 23 | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "addressSeq") 24 | public long getId() { 25 | return id; 26 | } 27 | 28 | public void setId(long id) { 29 | this.id = id; 30 | } 31 | 32 | public String getStreet() { 33 | return street; 34 | } 35 | 36 | public void setStreet(String name) { 37 | this.street = name; 38 | } 39 | 40 | public void describeFully(StringBuilder sb) { 41 | sb.append("Address with id=").append(id).append(", street='").append(street).append("'"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/Status.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | @SuppressWarnings("unused") 4 | public enum Status { 5 | LIVING, 6 | DECEASED 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/main/java/io/quarkiverse/jdbc/sqlite/it/jpa/WorkAddress.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.it.jpa; 2 | 3 | import jakarta.persistence.Embeddable; 4 | 5 | /** 6 | * Class marked @Embeddable explicitly so it is picked up. 7 | * 8 | * @author Emmanuel Bernard emmanuel@hibernate.org 9 | */ 10 | @SuppressWarnings("unused") 11 | @Embeddable 12 | public class WorkAddress { 13 | private String company; 14 | 15 | public String getCompany() { 16 | return company; 17 | } 18 | 19 | public void setCompany(String company) { 20 | this.company = company; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /integration-tests/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.datasource.db-kind=sqlite 2 | quarkus.datasource.jdbc.url=jdbc:sqlite::memory: 3 | #quarkus.datasource.jdbc.url=jdbc:sqlite:sample.db 4 | quarkus.hibernate-orm.database.generation=drop-and-create 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/java/io/quarkiverse/jdbc/sqlite/jdbc/sqlite/it/JDBCSqliteResourceIT.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.jdbc.sqlite.it; 2 | 3 | import io.quarkus.test.junit.QuarkusIntegrationTest; 4 | 5 | @QuarkusIntegrationTest 6 | public class JDBCSqliteResourceIT extends JDBCSqliteResourceTest { 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/java/io/quarkiverse/jdbc/sqlite/jdbc/sqlite/it/JDBCSqliteResourceTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.jdbc.sqlite.it; 2 | 3 | import static io.restassured.RestAssured.given; 4 | import static org.hamcrest.Matchers.is; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | import io.quarkus.test.junit.QuarkusTest; 9 | 10 | @QuarkusTest 11 | public class JDBCSqliteResourceTest { 12 | 13 | @Test 14 | public void testConnectionEndpoint() { 15 | given() 16 | .when().get("/JDBC-Sqlite/Connection") 17 | .then() 18 | .statusCode(200) 19 | .body(is("1/leo/2/yui/")); 20 | } 21 | 22 | @Test 23 | public void testAgoralEndpoint() { 24 | given() 25 | .when().get("/JDBC-Sqlite/Agoral") 26 | .then() 27 | .statusCode(200) 28 | .body(is("1/leo/2/yui/")); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /integration-tests/src/test/java/io/quarkiverse/jdbc/sqlite/jdbc/sqlite/it/jpa/JPAFunctionalityTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.jdbc.sqlite.it.jpa; 2 | 3 | import static org.hamcrest.Matchers.is; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.quarkus.test.junit.QuarkusTest; 8 | import io.restassured.RestAssured; 9 | 10 | /** 11 | * Test various JPA operations running in Quarkus 12 | */ 13 | @QuarkusTest 14 | public class JPAFunctionalityTest { 15 | 16 | @Test 17 | public void testJPAFunctionalityFromServlet() throws Exception { 18 | RestAssured.when().get("/jpa/testfunctionality").then().body(is("OK")); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /integration-tests/src/test/java/io/quarkiverse/jdbc/sqlite/jdbc/sqlite/it/jpa/JPAReflectionInGraalITCase.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.jdbc.sqlite.it.jpa; 2 | 3 | import static org.hamcrest.Matchers.is; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.quarkus.test.junit.QuarkusIntegrationTest; 8 | import io.restassured.RestAssured; 9 | 10 | /** 11 | * Test reflection around JPA entities 12 | * 13 | * @author Emmanuel Bernard emmanuel@hibernate.org 14 | */ 15 | @QuarkusIntegrationTest 16 | public class JPAReflectionInGraalITCase { 17 | 18 | @Test 19 | public void testFieldAndGetterReflectionOnEntityFromServlet() throws Exception { 20 | RestAssured.when().get("/jpa/testreflection").then().body(is("OK")); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /integration-tests/src/test/java/io/quarkiverse/jdbc/sqlite/jdbc/sqlite/it/jpa/OverrideJdbcUrlBuildTimeConfigSource.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.jdbc.sqlite.it.jpa; 2 | 3 | import java.util.HashMap; 4 | 5 | import jakarta.annotation.Priority; 6 | 7 | import org.eclipse.microprofile.config.ConfigProvider; 8 | import org.eclipse.microprofile.config.spi.ConfigSource; 9 | 10 | import io.smallrye.config.Priorities; 11 | import io.smallrye.config.common.MapBackedConfigSource; 12 | 13 | // To test https://github.com/quarkusio/quarkus/issues/16123 14 | @Priority(Priorities.APPLICATION + 100) 15 | public class OverrideJdbcUrlBuildTimeConfigSource extends MapBackedConfigSource { 16 | public OverrideJdbcUrlBuildTimeConfigSource() { 17 | super(OverrideJdbcUrlBuildTimeConfigSource.class.getName(), new HashMap<>(), 1000); 18 | } 19 | 20 | @Override 21 | public String getValue(final String propertyName) { 22 | if (!propertyName.equals("quarkus.datasource.jdbc.url")) { 23 | return super.getValue(propertyName); 24 | } 25 | 26 | boolean isBuildTime = false; 27 | for (ConfigSource configSource : ConfigProvider.getConfig().getConfigSources()) { 28 | if (configSource.getClass().getSimpleName().equals("BuildTimeEnvConfigSource")) { 29 | isBuildTime = true; 30 | break; 31 | } 32 | } 33 | 34 | if (isBuildTime) { 35 | return "${sqlite.url}"; 36 | } 37 | 38 | return super.getValue(propertyName); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | io.quarkiverse 6 | quarkiverse-parent 7 | 18 8 | 9 | io.quarkiverse.jdbc 10 | quarkus-jdbc-sqlite-parent 11 | 999-SNAPSHOT 12 | pom 13 | Quarkus - JDBC SQLite - Parent 14 | 15 | deployment 16 | runtime 17 | 18 | 19 | scm:git:git@github.com:quarkiverse/quarkus-jdbc-sqlite.git 20 | scm:git:git@github.com:quarkiverse/quarkus-jdbc-sqlite.git 21 | https://github.com/quarkiverse/quarkus-jdbc-sqlite 22 | HEAD 23 | 24 | 25 | 3.18.3 26 | 3.49.0.0 27 | 28 | 29 | 30 | 31 | io.quarkus 32 | quarkus-bom 33 | ${quarkus.version} 34 | pom 35 | import 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | io.quarkus 44 | quarkus-maven-plugin 45 | ${quarkus.version} 46 | 47 | 48 | io.quarkus 49 | quarkus-config-doc-maven-plugin 50 | ${quarkus.version} 51 | 52 | 53 | 54 | 55 | 56 | 57 | docs 58 | 59 | 60 | performRelease 61 | !true 62 | 63 | 64 | 65 | docs 66 | 67 | 68 | 69 | it 70 | 71 | 72 | performRelease 73 | !true 74 | 75 | 76 | 77 | integration-tests 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /runtime/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | io.quarkiverse.jdbc 6 | quarkus-jdbc-sqlite-parent 7 | 999-SNAPSHOT 8 | 9 | quarkus-jdbc-sqlite 10 | Quarkus - JDBC SQLite - Runtime 11 | Connect to the SQLite database via JDBC 12 | 13 | 14 | io.quarkus 15 | quarkus-arc 16 | 17 | 18 | io.quarkus 19 | quarkus-agroal 20 | true 21 | 22 | 23 | 24 | org.xerial 25 | sqlite-jdbc 26 | ${sqlite-jdbc.version} 27 | 28 | 29 | org.hibernate.orm 30 | hibernate-community-dialects 31 | 32 | 33 | 34 | 35 | 36 | io.quarkus 37 | quarkus-extension-maven-plugin 38 | ${quarkus.version} 39 | 40 | 41 | compile 42 | 43 | extension-descriptor 44 | 45 | 46 | ${project.groupId}:${project.artifactId}-deployment:${project.version} 47 | 48 | 49 | 50 | 51 | 52 | maven-compiler-plugin 53 | 54 | 55 | 56 | io.quarkus 57 | quarkus-extension-processor 58 | ${quarkus.version} 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /runtime/src/main/java/io/quarkiverse/jdbc/sqlite/runtime/SQLiteConstants.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.runtime; 2 | 3 | /** 4 | * Constants for SQLite. 5 | */ 6 | public class SQLiteConstants { 7 | 8 | private SQLiteConstants() { 9 | // cannot be instantiated - constant class 10 | } 11 | 12 | /** 13 | * DB-kind. 14 | */ 15 | public static final String DB_KIND = "sqlite"; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /runtime/src/main/java/io/quarkiverse/jdbc/sqlite/runtime/SqliteAgroalConnectionConfigurer.java: -------------------------------------------------------------------------------- 1 | package io.quarkiverse.jdbc.sqlite.runtime; 2 | 3 | import io.agroal.api.configuration.supplier.AgroalDataSourceConfigurationSupplier; 4 | import io.quarkus.agroal.runtime.AgroalConnectionConfigurer; 5 | import io.quarkus.agroal.runtime.JdbcDriver; 6 | 7 | /** 8 | * Empty Agroal configurer 9 | * 10 | */ 11 | @JdbcDriver(SQLiteConstants.DB_KIND) 12 | public class SqliteAgroalConnectionConfigurer implements AgroalConnectionConfigurer { 13 | 14 | @Override 15 | public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { 16 | // do not log anything for SQLite 17 | } 18 | 19 | @Override 20 | public void setExceptionSorter(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { 21 | // Do not log a warning: we don't have an exception sorter for SQLite, 22 | // but there is nothing the user can do about it. 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /runtime/src/main/resources/META-INF/quarkus-extension.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | artifact: ${project.groupId}:${project.artifactId}:${project.version} 3 | name: "JDBC Driver - Sqlite" 4 | metadata: 5 | keywords: 6 | - "jdbc-sqlite" 7 | - "jdbc" 8 | - "sqlite" 9 | categories: 10 | - "data" 11 | status: "stable" 12 | description: "Connect to the Sqlite database via JDBC/DataSource/Hibernate" 13 | --------------------------------------------------------------------------------