This is an automated email from the ASF dual-hosted git repository. ntimofeev pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cayenne-examples.git
The following commit(s) were added to refs/heads/master by this push: new 17084ca Update README and tweak project to be more portable. 17084ca is described below commit 17084ca55608bb89a3169612e8935e086748b058 Author: Nikita Timofeev <stari...@gmail.com> AuthorDate: Fri Sep 11 19:26:24 2020 +0300 Update README and tweak project to be more portable. --- cayenne-jdbc-type-other/README.md | 35 +++++++++++++++++++++- cayenne-jdbc-type-other/pom.xml | 28 +++++++++++++++++ .../java/org/apache/cayenne/demo/Application.java | 2 +- .../src/main/resources/config.yml | 2 +- 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/cayenne-jdbc-type-other/README.md b/cayenne-jdbc-type-other/README.md index 0fd98b8..bc9b0b3 100644 --- a/cayenne-jdbc-type-other/README.md +++ b/cayenne-jdbc-type-other/README.md @@ -1 +1,34 @@ -== Cayenne Example \ No newline at end of file +## Cayenne 4.2 JDBC ``Type.OTHER`` support demo. + +This example shows support for DB specific types that are not part of the JDBC spec. +Apache Cayenne supports Json and Geo types that are available in many modern RDBMS. + +The demo uses ``Wkt`` and ``Json`` types, +later additionally wrapped into custom value type ``ObjectNode`` provided by the Jackson library. + +### Usage + +Start PostGIS DB: + +```shell script +docker run --name cayenne-postgis -p 5432:5432 -e POSTGRES_PASSWORD=cayenne -e POSTGRES_USER=cayenne -e POSTGRES_DB=cayenne-postgis -d postgis/postgis +``` + +Build: + +```shell script +mvn package +``` + +Run: + +```shell script +java -jar target/cayenne-jdbc-type-other-1.0-SNAPSHOT.jar -j +java -jar target/cayenne-jdbc-type-other-1.0-SNAPSHOT.jar -g +``` + +See Cayenne project: + +```shell script +mvn cayenne-modeler:run +``` \ No newline at end of file diff --git a/cayenne-jdbc-type-other/pom.xml b/cayenne-jdbc-type-other/pom.xml index 6a8d0db..db30eb0 100644 --- a/cayenne-jdbc-type-other/pom.xml +++ b/cayenne-jdbc-type-other/pom.xml @@ -23,6 +23,7 @@ <compiler.plugin.version>3.8.1</compiler.plugin.version> <jar.plugin.version>3.2.0</jar.plugin.version> + <shade.plugin.version>3.2.1</shade.plugin.version> <surefire.plugin.version>2.22.2</surefire.plugin.version> <failsafe.plugin.version>2.22.2</failsafe.plugin.version> </properties> @@ -98,10 +99,37 @@ <groupId>org.apache.cayenne.plugins</groupId> <artifactId>cayenne-modeler-maven-plugin</artifactId> <version>${cayenne.version}</version> + <configuration> + <modelFile>${project.basedir}/src/main/resources/cayenne-demo.xml</modelFile> + </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>${shade.plugin.version}</version> + <configuration> + <createDependencyReducedPom>true</createDependencyReducedPom> + </configuration> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> + <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <mainClass>${main.class}</mainClass> + </transformer> + </transformers> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>${jar.plugin.version}</version> </plugin> diff --git a/cayenne-jdbc-type-other/src/main/java/org/apache/cayenne/demo/Application.java b/cayenne-jdbc-type-other/src/main/java/org/apache/cayenne/demo/Application.java index 318e840..9528047 100644 --- a/cayenne-jdbc-type-other/src/main/java/org/apache/cayenne/demo/Application.java +++ b/cayenne-jdbc-type-other/src/main/java/org/apache/cayenne/demo/Application.java @@ -14,7 +14,7 @@ public class Application extends BaseBQModule implements BQModuleProvider { public static void main(String[] args) { Bootique.app(args) - .args("--config=classpath:config.yml", "-g") + .args("--config=classpath:config.yml") .module(b -> BQCoreModule.extend(b) .addCommand(GeoTestCommand.class) .addCommand(JsonTestCommand.class) diff --git a/cayenne-jdbc-type-other/src/main/resources/config.yml b/cayenne-jdbc-type-other/src/main/resources/config.yml index 0c0418f..28755cc 100644 --- a/cayenne-jdbc-type-other/src/main/resources/config.yml +++ b/cayenne-jdbc-type-other/src/main/resources/config.yml @@ -10,7 +10,7 @@ jdbc: cayenne: datasource: geo - createSchema: false + createSchema: true maps: - location: classpath:demo.map.xml name: map1 \ No newline at end of file