-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce CrateDbDialect ** specializing on differences to Postgres 14
** no sequences ** different timestamp creation (no prescision) ** map JSON as OBJECT(DYNAMIC) ** map array as array(elementTypeName) instead of ... elementTypeName array ** exclude unsupported features introduce CrateJsonType without casting (postgres default) show it on an example panache entity
- Loading branch information
Showing
23 changed files
with
1,194 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* | ||
!build/*-runner | ||
!build/*-runner.jar | ||
!build/lib/* | ||
!build/quarkus-app/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Gradle | ||
.gradle/ | ||
build/ | ||
|
||
# Eclipse | ||
.project | ||
.classpath | ||
.settings/ | ||
bin/ | ||
|
||
# IntelliJ | ||
.idea | ||
*.ipr | ||
*.iml | ||
*.iws | ||
|
||
# NetBeans | ||
nb-configuration.xml | ||
|
||
# Visual Studio Code | ||
.vscode | ||
.factorypath | ||
|
||
# OSX | ||
.DS_Store | ||
|
||
# Vim | ||
*.swp | ||
*.swo | ||
|
||
# patch | ||
*.orig | ||
*.rej | ||
|
||
# Local environment | ||
.env | ||
|
||
# Plugin directory | ||
/.quarkus/cli/plugins/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
java=21.0.3-tem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Crate JPA Panache usage | ||
|
||
This project shows how crate can be utilized with Quarkus in a very intuitive way using Hibernate ORM deriving from postgres. | ||
Within the CrateDbDialect differences to postgres are treated - e.g. JSON, timestamp (no precission in crate), and the array differences in the ddl. | ||
Futhermore there is the CrateJsonJdbcType that overrides the default postgres driver handling which uses jsonb. | ||
|
||
Finally things that crate does not support need to be addressed in the dialect (sequences, alter table if) ... with that adaptations it was possible to use crate in a native way for java development. | ||
|
||
# code-with-quarkus | ||
|
||
This project uses Quarkus, the Supersonic Subatomic Java Framework. | ||
|
||
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . | ||
|
||
## Running the application in dev mode | ||
|
||
You can run your application in dev mode that enables live coding using: | ||
|
||
```shell script | ||
./gradlew quarkusDev | ||
``` | ||
|
||
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/. | ||
## Packaging and running the application | ||
|
||
The application can be packaged using: | ||
|
||
```shell script | ||
./gradlew build | ||
``` | ||
|
||
It produces the `quarkus-run.jar` file in the `build/quarkus-app/` directory. | ||
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `build/quarkus-app/lib/` directory. | ||
|
||
The application is now runnable using `java -jar build/quarkus-app/quarkus-run.jar`. | ||
|
||
If you want to build an _über-jar_, execute the following command: | ||
|
||
```shell script | ||
./gradlew build -Dquarkus.package.type=uber-jar | ||
``` | ||
|
||
The application, packaged as an _über-jar_, is now runnable using `java -jar build/*-runner.jar`. | ||
|
||
## Creating a native executable | ||
|
||
You can create a native executable using: | ||
|
||
```shell script | ||
./gradlew build -Dquarkus.package.type=native | ||
``` | ||
|
||
Or, if you don't have GraalVM installed, you can run the native executable build in a container using: | ||
|
||
```shell script | ||
./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true | ||
``` | ||
|
||
You can then execute your native executable with: `./build/code-with-quarkus-1.0.0-SNAPSHOT-runner` | ||
|
||
If you want to learn more about building native executables, please consult https://quarkus.io/guides/gradle-tooling. | ||
|
||
## Related Guides | ||
|
||
- Hibernate ORM with Panache ([guide](https://quarkus.io/guides/hibernate-orm-panache)): Simplify your persistence code for Hibernate ORM via the active record or the repository pattern | ||
- JDBC Driver - PostgreSQL ([guide](https://quarkus.io/guides/datasource)): Connect to the PostgreSQL database via JDBC | ||
|
||
## Provided Code | ||
|
||
### Hibernate ORM | ||
|
||
Create your first JPA entity | ||
|
||
[Related guide section...](https://quarkus.io/guides/hibernate-orm) | ||
|
||
[Related Hibernate with Panache section...](https://quarkus.io/guides/hibernate-orm-panache) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
plugins { | ||
id 'java' | ||
id 'io.quarkus' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
implementation 'io.quarkus:quarkus-hibernate-orm-panache' | ||
implementation 'io.quarkus:quarkus-jdbc-postgresql' | ||
implementation 'io.quarkus:quarkus-arc' | ||
implementation 'io.quarkus:quarkus-hibernate-orm' | ||
implementation 'io.quarkus:quarkus-jackson' // needed for json serializing | ||
testImplementation 'io.quarkus:quarkus-junit5' | ||
testImplementation 'org.testcontainers:cratedb:1.19.7' | ||
testImplementation "org.testcontainers:junit-jupiter:1.19.7" | ||
} | ||
|
||
group 'org.acme' | ||
version '1.0.0-SNAPSHOT' | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
targetCompatibility = JavaVersion.VERSION_21 | ||
} | ||
|
||
test { | ||
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager" | ||
} | ||
compileJava { | ||
options.encoding = 'UTF-8' | ||
options.compilerArgs << '-parameters' | ||
} | ||
|
||
compileTestJava { | ||
options.encoding = 'UTF-8' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Gradle properties | ||
quarkusPluginId=io.quarkus | ||
quarkusPluginVersion=3.8.3 | ||
quarkusPlatformGroupId=io.quarkus.platform | ||
quarkusPlatformArtifactId=quarkus-bom | ||
quarkusPlatformVersion=3.8.3 |
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
by-language/java-quarkus-panache/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.