diff --git a/Basic/constants.properties b/Basic/constants.properties index 0b0f28b2..e2d6b3ba 100644 --- a/Basic/constants.properties +++ b/Basic/constants.properties @@ -1,7 +1,7 @@ cordaReleaseGroup=net.corda cordaCoreReleaseGroup=net.corda -cordaVersion=4.5-RC02 -cordaCoreVersion=4.5-RC02 +cordaVersion=4.6-20200713_101257-adeea5c +cordaCoreVersion=4.6-20200713_101257-adeea5c gradlePluginsVersion=5.0.10 kotlinVersion=1.2.71 junitVersion=4.12 diff --git a/Basic/cordapp-example/README.md b/Basic/cordapp-example/README.md index 642ccc14..76de0269 100644 --- a/Basic/cordapp-example/README.md +++ b/Basic/cordapp-example/README.md @@ -6,4 +6,31 @@ Welcome to the example CorDapp. This CorDapp is fully documented [here](http://docs.corda.net/tutorial-cordapp.html). -This example application has modules for both Java and Kotlin and is an exploratory sample for the official [Corda online training](https://training.corda.net). It demonstrates the basic components present in a CorDapp and how they work together using a simple IOU example. \ No newline at end of file +This example application has modules for both Java and Kotlin and is an exploratory sample for the official [Corda online training](https://training.corda.net). It demonstrates the basic components present in a CorDapp and how they work together using a simple IOU example. + +Additional Notes: + +With Corda release 4.6, open source cordapps will have to write liquibase scripts to generate the custom database tables. +For rapid development in dev mode with H2, you could use below command to generate Hibernate entities for your custom schemas. You will not +require Liquibase scripts in such a situation. + + java -jar corda.jar run-migration-scripts --app-schemas + +Liquibase scripts have been added to workflow-java/src/main/resojurces/migration folder. + +To run the migration scripts for corda node use below command + + java -jar corda.jar run-migration-scripts --core-schemas + + +To run the migration scripts for your custom tables defined in your Cordapp use below command + + java -jar corda.jar run-migration-scripts --app-schemas + +If you already have hibernate entities created in your db, prior to using Corda version 4.6, use below command to sync the database + + java -jar corda.jar sync-app-schemas + + +Read more about hwo to add liquibase to your cordapp here. +# TODO update documentation link. diff --git a/Basic/cordapp-example/build.gradle b/Basic/cordapp-example/build.gradle index 5bad0db2..6d70c92c 100644 --- a/Basic/cordapp-example/build.gradle +++ b/Basic/cordapp-example/build.gradle @@ -22,6 +22,7 @@ buildscript { maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev/' } mavenLocal() } diff --git a/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java b/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java index bce0354b..83a2cb28 100644 --- a/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java +++ b/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java @@ -3,11 +3,13 @@ import net.corda.core.schemas.MappedSchema; import net.corda.core.schemas.PersistentState; +import javax.annotation.Nullable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import java.util.Arrays; import java.util.UUID; +import org.hibernate.annotations.Type; /** * An IOUState schema. @@ -17,13 +19,20 @@ public IOUSchemaV1() { super(IOUSchema.class, 1, Arrays.asList(PersistentIOU.class)); } + @Nullable + @Override + public String getMigrationResource() { + return "iou.changelog-master"; + } + + @Entity @Table(name = "iou_states") public static class PersistentIOU extends PersistentState { @Column(name = "lender") private final String lender; @Column(name = "borrower") private final String borrower; @Column(name = "value") private final int value; - @Column(name = "linear_id") private final UUID linearId; + @Column(name = "linear_id") @Type (type = "uuid-char") private final UUID linearId; public PersistentIOU(String lender, String borrower, int value, UUID linearId) { diff --git a/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt b/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt index c94883f3..51f958b3 100644 --- a/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt +++ b/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt @@ -2,6 +2,7 @@ package com.example.schema import net.corda.core.schemas.MappedSchema import net.corda.core.schemas.PersistentState +import org.hibernate.annotations.Type import java.util.* import javax.persistence.Column import javax.persistence.Entity @@ -19,6 +20,11 @@ object IOUSchemaV1 : MappedSchema( schemaFamily = IOUSchema.javaClass, version = 1, mappedTypes = listOf(PersistentIOU::class.java)) { + + override val migrationResource: String? + get() = "iou.changelog-master"; + + @Entity @Table(name = "iou_states") class PersistentIOU( @@ -32,6 +38,7 @@ object IOUSchemaV1 : MappedSchema( var value: Int, @Column(name = "linear_id") + @Type(type = "uuid-char") var linearId: UUID ) : PersistentState() { // Default constructor required by hibernate. diff --git a/Basic/cordapp-example/repositories.gradle b/Basic/cordapp-example/repositories.gradle index 2874c2ab..db6ab8db 100644 --- a/Basic/cordapp-example/repositories.gradle +++ b/Basic/cordapp-example/repositories.gradle @@ -4,5 +4,6 @@ repositories { jcenter() maven { url 'https://jitpack.io' } maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev/' } maven { url 'https://repo.gradle.org/gradle/libs-releases' } } diff --git a/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-master.xml b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-master.xml new file mode 100644 index 00000000..5ea2e5fd --- /dev/null +++ b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-master.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml new file mode 100644 index 00000000..fb9b580d --- /dev/null +++ b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-master.xml b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-master.xml new file mode 100644 index 00000000..5ea2e5fd --- /dev/null +++ b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-master.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml new file mode 100644 index 00000000..fb9b580d --- /dev/null +++ b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Features/constants.properties b/Features/constants.properties index 0b0f28b2..e2d6b3ba 100644 --- a/Features/constants.properties +++ b/Features/constants.properties @@ -1,7 +1,7 @@ cordaReleaseGroup=net.corda cordaCoreReleaseGroup=net.corda -cordaVersion=4.5-RC02 -cordaCoreVersion=4.5-RC02 +cordaVersion=4.6-20200713_101257-adeea5c +cordaCoreVersion=4.6-20200713_101257-adeea5c gradlePluginsVersion=5.0.10 kotlinVersion=1.2.71 junitVersion=4.12 diff --git a/Features/queryableState-carinsurance/README.md b/Features/queryableState-carinsurance/README.md index 843cc7ec..1a5912a0 100644 --- a/Features/queryableState-carinsurance/README.md +++ b/Features/queryableState-carinsurance/README.md @@ -71,4 +71,31 @@ http://www.h2database.com/html/download.html

Refer here for more details regarding connecting to the node database. -https://docs.corda.net/head/node-database-access-h2.html \ No newline at end of file +https://docs.corda.net/head/node-database-access-h2.html + +Additional Notes: + +With Corda release 4.6, open source cordapps will have to write liquibase scripts to generate the custom database tables. +For rapid development in dev mode with H2, you could use below command to generate Hibernate entities for your custom schemas. You will not +require Liquibase scripts in such a situation. + + java -jar corda.jar run-migration-scripts --app-schemas + +Liquibase scripts have been added to workflow-java/src/main/resojurces/migration folder. + +To run the migration scripts for corda node use below command + + java -jar corda.jar run-migration-scripts --core-schemas + + +To run the migration scripts for your custom tables defined in your Cordapp use below command + + java -jar corda.jar run-migration-scripts --app-schemas + +If you already have hibernate entities created in your db, prior to using Corda version 4.6, use below command to sync the database + + java -jar corda.jar sync-app-schemas + + +Read more about hwo to add liquibase to your cordapp here. +# TODO update documentation link. diff --git a/Features/queryableState-carinsurance/build.gradle b/Features/queryableState-carinsurance/build.gradle index 2bc6c258..e41a17fc 100644 --- a/Features/queryableState-carinsurance/build.gradle +++ b/Features/queryableState-carinsurance/build.gradle @@ -24,6 +24,8 @@ buildscript { mavenCentral() jcenter() maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev/' } + } dependencies { diff --git a/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt b/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt index 6f2414d7..b27c8611 100644 --- a/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt +++ b/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt @@ -2,6 +2,7 @@ package net.corda.samples.schema import net.corda.core.schemas.MappedSchema import net.corda.core.schemas.PersistentState +import org.hibernate.annotations.Type import java.io.Serializable import java.util.* import javax.persistence.* @@ -19,10 +20,16 @@ object InsuranceSchemaV1 : MappedSchema( version = 1, mappedTypes = listOf(PersistentClaim::class.java, PersistentInsurance::class.java, PersistentVehicle::class.java)) { + + override val migrationResource: String? + get() = "insurance.changelog-master"; + + @Entity @Table(name = "CLAIM_DETAIL") class PersistentClaim( @Id @Column(name = "Id") + @Type(type = "uuid-char") val uuid:UUID, @Column(name = "claimNumber") @@ -42,6 +49,7 @@ object InsuranceSchemaV1 : MappedSchema( @Table(name = "VEHICLE_DETAIL") class PersistentVehicle( @Id @Column(name = "Id") + @Type (type = "uuid-char") val uuid:UUID, @Column(name = "registrationNumber") diff --git a/Features/queryableState-carinsurance/repositories.gradle b/Features/queryableState-carinsurance/repositories.gradle index 2874c2ab..f3ec40bb 100644 --- a/Features/queryableState-carinsurance/repositories.gradle +++ b/Features/queryableState-carinsurance/repositories.gradle @@ -3,6 +3,7 @@ repositories { mavenCentral() jcenter() maven { url 'https://jitpack.io' } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev/' } maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } maven { url 'https://repo.gradle.org/gradle/libs-releases' } } diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml new file mode 100644 index 00000000..cb08c3e0 --- /dev/null +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml new file mode 100644 index 00000000..be89e59b --- /dev/null +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance.changelog-master.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance.changelog-master.xml new file mode 100644 index 00000000..c743c316 --- /dev/null +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance.changelog-master.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml new file mode 100644 index 00000000..101fe505 --- /dev/null +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file