Skip to content

Commit

Permalink
Update README and tweak project to be more portable.
Browse files Browse the repository at this point in the history
  • Loading branch information
stariy95 committed Sep 11, 2020
1 parent c47c38f commit 17084ca
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 3 deletions.
35 changes: 34 additions & 1 deletion cayenne-jdbc-type-other/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
== Cayenne Example
## 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
```
28 changes: 28 additions & 0 deletions cayenne-jdbc-type-other/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -98,8 +99,35 @@
<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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cayenne-jdbc-type-other/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jdbc:

cayenne:
datasource: geo
createSchema: false
createSchema: true
maps:
- location: classpath:demo.map.xml
name: map1

0 comments on commit 17084ca

Please sign in to comment.