This is one of the Holon Platform example projects.
This example shows how to deal with the basic operations of the Datastore
API, using a JPA Datastore implementation and a H2 in-memory database.
Spring Boot is used for automatic DataSource
, ORM (Hibernate in this example) and Datastore
configuration, activated by the holon-starter-jpa-hibernate
starter. See the example pom.
NOTE: This is the JPA version of the JDBC Datastore example.
This example addresses the following topics:
- Automatic setup of a JPA Datastore using the Holon Platform Spring Boot integration
- Management of a simple data entity using the
Datastore
API (create, update, delete, query)
The schema.sql script creates the products
table at application startup time.
The Product class represents the property model for a simple product entity.
The ProductEntity class is the JPA entity which maps the products
table.
Please note:
-
The
WITHDRAWN
Product property is configured with a property value converter to automatically convert theinteger
type of the database table column to theBoolean
type. -
The
TARGET
field of the Product class is the definition of aDataTarget
which refers to theProductEntity
JPA entity to be used withDatastore
operations.
The TestDatastore class is a JUnit test class to show how to use the Datastore
API to create, update delete and query the products, relying on the PropertyBox
type to handle the property values.
Run the unit test class using mvn test
or your favorite IDE command.
The complete Holon Platform reference guide is available here.
For the specific documentation about the components used in this example see:
The Holon Platform is built using Java 8, so you need a JRE/JDK version 8 or above to build and run this example projects.
All the Holon Platform modules and examples are Open Source software released under the Apache 2.0 license.
See Holon Platform Examples for the examples directory.