https://github.com/soujava/nosql-value-writer
A sample using Jakarta NoSQL ValueWriter
https://github.com/soujava/nosql-value-writer
Last synced: 6 months ago
JSON representation
A sample using Jakarta NoSQL ValueWriter
- Host: GitHub
- URL: https://github.com/soujava/nosql-value-writer
- Owner: soujava
- License: apache-2.0
- Created: 2023-02-28T06:32:55.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-28T12:22:31.000Z (almost 3 years ago)
- Last Synced: 2025-01-27T10:45:04.283Z (11 months ago)
- Language: Java
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 15
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ValueWriter Example

You are creating a converter for Eclipse NoSQL that will work without a mapping annotation. You can use both ValueWriter and ValueReader.
* **ValueWriter**: This interface represents an instance of Value to write in a database.
* **ValueReader**: This interface represents how the Value will convert to Java application. This interface will use the T get(Class type) and T get(TypeSupplier typeSupplier).
## Steps
* The first step is to create the converter to a custom type database, the ValueWriter.
* ValueWriter created and the Money type will save as String, then the next step is read information to Java application. As can be seen, a ValueReader implementation.
After both implementations have been completed, the last step is to register them into two files:
* `META-INF/services/jakarta.nosql.ValueReader`
* `META-INF/services/jakarta.nosql.ValueWriter`
## Using Docker
1. Install docker: https://www.docker.com/
2. https://store.docker.com/images/mongo
3. Run docker command
4. Run MongoDB: verify MongoDB image name with the command `docker images`, it can be mongodb or mongo, and then execute this command
1. `docker run -d --name mongodb-instance -p 27017:27017 mongo`
## Run the code
With a MongoDB instance running go to the class **App** and have fun.