hyperledger / hyperledger/fabric-samples
Feature Request: Add Java implementation for `asset-transfer-ledger-queries` sample
- Dominant language
- Go
- Stars
- 3k
- Forks
- 3.5k
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 6
Description
#### **Overview**
Currently, the `asset-transfer-ledger-queries` sample in the `fabric-samples` repository provides smart contract implementations in Go, JavaScript, and TypeScript. However, it lacks a Java implementation for the chaincode.
#### **Motivation**
The "Ledger Queries" sample is a crucial part of the Fabric documentation, as it demonstrates how to perform complex JSON queries using CouchDB. Many enterprise developers using the Hyperledger Fabric Java SDK would benefit from a reference implementation that shows:
1. How to implement rich query logic in Java.
2. How to structure the `META-INF` directory within a Gradle-based project to ensure indexes are correctly bundled.
3. How to achieve feature parity with the Go and Node.js samples.
#### **Proposed Changes**
1. **Add `chaincode-java` Directory:** A complete Gradle-based Java implementation of the Ledger Queries smart contract.
2. **Update `packageCC.sh`:** (Optional but recommended) Update the build script to ensure that `META-INF` resources are correctly copied from `src/main/resources` to the installation distribution directory during the `installDist` task.
3. **Update Root README:** Modify the samples table to include Java in the "Smart contract languages" column for the `asset-transfer-ledger-queries` entry.
#### **Validation**
The proposed Java chaincode has been tested using the `test-network` and verified to correctly execute JSON queries against a CouchDB state database.
#### **Additional Context**
I have already developed the implementation locally and can submit a PR immediately once this issue is acknowledged.
Contributor guide
Assessment
This issue has not been assessed yet.