Skip to content

it09/corda101-persistence

Repository files navigation

database-vaultquery cordapp

This CorDapp demonstrates QueryableState works in Corda. Corda allows developers to have the ability to expose some or all parts of their states to a custom database table using an ORM tools. To support this feature the state must implement QueryableState.

In this CorDapp we would use an Product state and persist its properties in a custom table in the database. We have used this ProductDetail to demonstrate One-to-One relationship.

Flows

There are two flow in this cordapp:

  1. [IssueProductStateFlow]: It issues a product state.

  2. [QueryDatabaseVaultQueryFlow]: This is used to retrieve the created product state from the vault.

Usage

Pre-requisites:

See https://docs.corda.net/getting-set-up.html.

Running the CorDapp

Open a terminal and go to the project root directory and type: (to deploy the nodes using bootstrapper)

./gradlew clean deployNodes

Then type: (to run the nodes)

./build/nodes/runnodes

Connecting to the Database

The JDBC url to connect to the database would be printed in the console in node startup. Use the url to connect to the database using a suitable client. The default username is 'sa' and password is '' (blank). You could download H2 Console to connect to h2 database here: http://www.h2database.com/html/download.html

Database URL

Refer here for more details regarding connecting to the node database. https://docs.corda.net/head/node-database-access-h2.html

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages