{"id":20704647,"url":"https://github.com/holon-platform/holon-datastore-jpa","last_synced_at":"2025-04-23T01:28:14.359Z","repository":{"id":57725002,"uuid":"93082263","full_name":"holon-platform/holon-datastore-jpa","owner":"holon-platform","description":"Holon Platform JPA Datastore module. This is the Java Persistence API implementation of the Datastore API, with relational expressions and transactions support, along with a full Spring and Spring Boot integration. ","archived":false,"fork":false,"pushed_at":"2023-11-14T14:11:19.000Z","size":896,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T20:51:09.055Z","etag":null,"topics":["database","datastore","eclipselink","hibernate","holon-platform","jpa","jpa-datastore","jpa-entities","orm","spring-boot"],"latest_commit_sha":null,"homepage":"https://holon-platform.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holon-platform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2017-06-01T17:24:39.000Z","updated_at":"2024-01-14T12:44:25.000Z","dependencies_parsed_at":"2023-11-14T15:30:00.335Z","dependency_job_id":"530d717b-36bc-41e3-a588-4ea73faa97f2","html_url":"https://github.com/holon-platform/holon-datastore-jpa","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holon-platform%2Fholon-datastore-jpa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holon-platform%2Fholon-datastore-jpa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holon-platform%2Fholon-datastore-jpa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holon-platform%2Fholon-datastore-jpa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holon-platform","download_url":"https://codeload.github.com/holon-platform/holon-datastore-jpa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250351521,"owners_count":21416336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","datastore","eclipselink","hibernate","holon-platform","jpa","jpa-datastore","jpa-entities","orm","spring-boot"],"created_at":"2024-11-17T01:14:17.592Z","updated_at":"2025-04-23T01:28:14.342Z","avatar_url":"https://github.com/holon-platform.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Holon platform JPA Datastore\n\n\u003e Latest release: [5.7.0](#obtain-the-artifacts)\n\nThis is the reference __JPA__ `Datastore` implementation of the [Holon Platform](https://holon-platform.com), using the Java `JPA` API for data access and manipulation.\n\nThe JPA Datastore relies on the following conventions regarding __DataTarget__ and __Path__ naming strategy:\n\n* The [DataTarget](https://docs.holon-platform.com/current/reference/holon-core.html#DataTarget) _name_ is interpreted as the JPA _entity_ name.\n* The [Path](https://docs.holon-platform.com/current/reference/holon-core.html#Path) _name_ is interpreted as a JPA _entity_ attribute name, supporting nested classes through the conventional _dot_ notation.\n\nAs a _relational Datastore_, standard [relational expressions](https://docs.holon-platform.com/current/reference/holon-datastore-jpa.html#Relational-expressions) are supported (alias, joins and sub-queries).\n\nThe JPA Datastore supports any standard JPA __ORM__ library, altough is tested and optimized specifically for:\n\n* [Hibernate](http://hibernate.org/orm) version __5.6__\n* [EclipseLink](http://www.eclipse.org/eclipselink) version __2.7 or above__\n\nA complete __Spring__ and __Spring Boot__ support is provided for JPA Datastore integration in a Spring environment and for __auto-configuration__ facilities.\n\nSee the module [documentation](https://docs.holon-platform.com/current/reference/holon-datastore-jpa.html) for details.\n\nJust like any other platform module, this artifact is part of the [Holon Platform](https://holon-platform.com) ecosystem, but can be also used as a _stand-alone_ library.\n\nSee [Getting started](#getting-started) and the [platform documentation](https://docs.holon-platform.com/current/reference) for further details.\n\n## At-a-glance overview\n\n_JPA Datastore operations:_\n```java\nDataTarget\u003cMyEntity\u003e TARGET = JpaTarget.of(MyEntity.class);\n\t\t\nDatastore datastore = JpaDatastore.builder().entityManagerFactory(myEntityManagerFactory).build();\n\ndatastore.save(TARGET, PropertyBox.builder(TEST).set(ID, 1L).set(VALUE, \"One\").build());\n\nStream\u003cPropertyBox\u003e results = datastore.query().target(TARGET).filter(ID.goe(1L)).stream(TEST);\n\nList\u003cString\u003e values = datastore.query().target(TARGET).sort(ID.asc()).list(VALUE);\n\nStream\u003cString\u003e values = datastore.query().target(TARGET).filter(VALUE.startsWith(\"prefix\")).restrict(10, 0).stream(VALUE);\n\nlong count = datastore.query(TARGET).aggregate(QueryAggregation.builder().path(VALUE).filter(ID.gt(1L)).build()).count();\n\nStream\u003cInteger\u003e months = datastore.query().target(TARGET).distinct().stream(LOCAL_DATE.month());\n\t\t\nList\u003cMyEntity\u003e entities = datastore.query().target(TARGET).list(BeanProjection.of(MyEntity.class));\n\ndatastore.bulkUpdate(TARGET).filter(ID.in(1L, 2L)).set(VALUE, \"test\").execute();\n\ndatastore.bulkDelete(TARGET).filter(ID.gt(0L)).execute();\n```\n\n_Transaction management:_\n```java\nlong updatedCount = datastore.withTransaction(tx -\u003e {\n\tlong updated = datastore.bulkUpdate(TARGET).set(VALUE, \"test\").execute().getAffectedCount();\n\t\t\t\n\ttx.commit();\n\t\t\t\n\treturn updated;\n});\n```\n\n_JPA Datastore configuration using Spring:_\n```java\n@EnableJpaDatastore\n@Configuration\nclass Config {\n\n  @Bean\n  public FactoryBean\u003cEntityManagerFactory\u003e entityManagerFactory(DataSource dataSource) {\n      LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();\n      emf.setDataSource(dataSource);\n      emf.setPackagesToScan(\"com.example.entities\");\n      return emf;\n  }\n\n}\n\n@Autowired\nDatastore datastore;\n```\n\n_JPA Datastore auto-configuration using Spring Boot:_\n```yaml\nspring:\n  datasource:\n    url: \"jdbc:h2:mem:test\"\n    username: \"sa\"\n    \nholon: \n  datastore:\n    trace: true\n```\n\nSee the [module documentation](https://docs.holon-platform.com/current/reference/holon-datastore-jpa.html) for the user guide and a full set of examples.\n\n## Code structure\n\nSee [Holon Platform code structure and conventions](https://github.com/holon-platform/platform/blob/master/CODING.md) to learn about the _\"real Java API\"_ philosophy with which the project codebase is developed and organized.\n\n## Getting started\n\n### System requirements\n\nThe Holon Platform is built using __Java 11__, so you need a JRE/JDK version 11 or above to use the platform artifacts.\n\nThe __JPA API version 2.x__ or above is reccomended to use all the functionalities of the JPA Datastore.\n\n### Releases\n\nSee [releases](https://github.com/holon-platform/holon-datastore-jpa/releases) for the available releases. Each release tag provides a link to the closed issues.\n\n### Obtain the artifacts\n\nThe [Holon Platform](https://holon-platform.com) is open source and licensed under the [Apache 2.0 license](LICENSE.md). All the artifacts (including binaries, sources and javadocs) are available from the [Maven Central](https://mvnrepository.com/repos/central) repository.\n\nThe Maven __group id__ for this module is `com.holon-platform.jpa` and a _BOM (Bill of Materials)_ is provided to obtain the module artifacts:\n\n_Maven BOM:_\n```xml\n\u003cdependencyManagement\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.holon-platform.jpa\u003c/groupId\u003e\n        \u003cartifactId\u003eholon-datastore-jpa-bom\u003c/artifactId\u003e\n        \u003cversion\u003e5.7.0\u003c/version\u003e\n        \u003ctype\u003epom\u003c/type\u003e\n        \u003cscope\u003eimport\u003c/scope\u003e\n    \u003c/dependency\u003e\n\u003c/dependencyManagement\u003e\n```\n\nSee the [Artifacts list](#artifacts-list) for a list of the available artifacts of this module.\n\n### Using the Platform BOM\n\nThe [Holon Platform](https://holon-platform.com) provides an overall Maven _BOM (Bill of Materials)_ to easily obtain all the available platform artifacts:\n\n_Platform Maven BOM:_\n```xml\n\u003cdependencyManagement\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.holon-platform\u003c/groupId\u003e\n        \u003cartifactId\u003ebom\u003c/artifactId\u003e\n        \u003cversion\u003e${platform-version}\u003c/version\u003e\n        \u003ctype\u003epom\u003c/type\u003e\n        \u003cscope\u003eimport\u003c/scope\u003e\n    \u003c/dependency\u003e\n\u003c/dependencyManagement\u003e\n```\n\nSee the [Artifacts list](#artifacts-list) for a list of the available artifacts of this module.\n\n### Build from sources\n\nYou can build the sources using Maven (version 3.3.x or above is recommended) like this: \n\n`mvn clean install`\n\n## Getting help\n\n* Check the [platform documentation](https://docs.holon-platform.com/current/reference) or the specific [module documentation](https://docs.holon-platform.com/current/reference/holon-datastore-jpa.html).\n\n* Ask a question on [Stack Overflow](http://stackoverflow.com). We monitor the [`holon-platform`](http://stackoverflow.com/tags/holon-platform) tag.\n\n* Report an [issue](https://github.com/holon-platform/holon-datastore-jpa/issues).\n\n* A [commercial support](https://holon-platform.com/services) is available too.\n\n## Examples\n\nSee the [Holon Platform examples](https://github.com/holon-platform/holon-examples) repository for a set of example projects.\n\n## Contribute\n\nSee [Contributing to the Holon Platform](https://github.com/holon-platform/platform/blob/master/CONTRIBUTING.md).\n\n[![Gitter chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/holon-platform/contribute?utm_source=share-link\u0026utm_medium=link\u0026utm_campaign=share-link) \nJoin the __contribute__ Gitter room for any question and to contact us.\n\n## License\n\nAll the [Holon Platform](https://holon-platform.com) modules are _Open Source_ software released under the [Apache 2.0 license](LICENSE).\n\n## Artifacts list\n\nMaven _group id_: `com.holon-platform.jpa`\n\nArtifact id | Description\n----------- | -----------\n`holon-datastore-jpa` | __JPA__ `Datastore` implementation\n`holon-datastore-jpa-spring` | __Spring__ integration using the `@EnableJpa` and  `@EnableJpaDatastore` annotations\n`holon-datastore-jpa-spring-boot` | __Spring Boot__ integration for JPA stack and Datastore auto-configuration\n`holon-starter-jpa-hibernate` | __Spring Boot__ _starter_ for JPA stack and Datastore auto-configuration using [Hibernate](http://hibernate.org/orm) ORM\n`holon-starter-jpa-eclipselink` | __Spring Boot__ _starter_ for JPA stack and Datastore auto-configuration using [EclipseLink](http://www.eclipse.org/eclipselink) ORM\n`holon-datastore-jpa-bom` | Bill Of Materials\n`documentation-datastore-jpa` | Documentation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholon-platform%2Fholon-datastore-jpa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholon-platform%2Fholon-datastore-jpa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholon-platform%2Fholon-datastore-jpa/lists"}