{"id":20704667,"url":"https://github.com/holon-platform/holon-datastore-jdbc","last_synced_at":"2025-04-23T01:28:53.030Z","repository":{"id":57724998,"uuid":"93082111","full_name":"holon-platform/holon-datastore-jdbc","owner":"holon-platform","description":"Holon Platform JDBC Datastore module. This is the JDBC 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:10:46.000Z","size":1278,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T20:51:09.450Z","etag":null,"topics":["database","datasource","datastore","dialects","holon-platform","java-api","jdbc","jdbc-datastore","rdbms","relational-databases","spring-boot","transactional"],"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:22:58.000Z","updated_at":"2023-11-10T17:16:11.000Z","dependencies_parsed_at":"2023-11-14T15:39:53.041Z","dependency_job_id":null,"html_url":"https://github.com/holon-platform/holon-datastore-jdbc","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holon-platform%2Fholon-datastore-jdbc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holon-platform%2Fholon-datastore-jdbc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holon-platform%2Fholon-datastore-jdbc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holon-platform%2Fholon-datastore-jdbc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holon-platform","download_url":"https://codeload.github.com/holon-platform/holon-datastore-jdbc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250351672,"owners_count":21416356,"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","datasource","datastore","dialects","holon-platform","java-api","jdbc","jdbc-datastore","rdbms","relational-databases","spring-boot","transactional"],"created_at":"2024-11-17T01:14:20.806Z","updated_at":"2025-04-23T01:28:53.006Z","avatar_url":"https://github.com/holon-platform.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Holon platform JDBC Datastore\n\n\u003e Latest release: [5.7.0](#obtain-the-artifacts)\n\nThis is the reference __JDBC__ implementation of the [Holon Platform](https://holon-platform.com) `Datastore` API, using the Java `JDBC` API and the `SQL` language for data access and manipulation.\n\nSee the [Datastore API documentation](https://docs.holon-platform.com/current/reference/holon-core.html#Datastore) for information about the Holon Platform `Datastore` API.\n\nThe JDBC Datastore implementation 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 database _table_ (or _view_) name.\n* The [Path](https://docs.holon-platform.com/current/reference/holon-core.html#Path) _name_ is interpreted as a table _column_ name.\n\nAs a _relational Datastore_, standard [relational expressions](https://docs.holon-platform.com/current/reference/holon-datastore-jdbc.html#Relational-expressions) are supported (alias, joins and sub-queries).\n\n__Transactions__ support is ensured through the Holon Platform `Transactional` API.\n\nThe JDBC Datastore leverages on __dialects__ to transparently support different RDBMS vendors. Dialects for the following RDBMS are provided:\n\n* MySQL\n* MariaDB\n* Oracle Database\n* Microsoft SQL Server\n* PostgreSQL\n* IBM DB2\n* IBM Informix\n* SAP HANA\n* H2\n* HSQLDB\n* Derby\n* SQLite\n\nA complete __Spring__ and __Spring Boot__ support is provided for JDBC 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-jdbc.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_JDBC Datastore operations:_\n```java\nDatastore datastore = JdbcDatastore.builder().dataSource(myDataSource).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\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_JDBC Datastore extension:_\n```java\n// Function definition\nclass IfNull\u003cT\u003e implements QueryFunction\u003cT, T\u003e {\n  /* content omitted */\t\t\n}\n\n// Function resolver\nclass IfNullResolver implements ExpressionResolver\u003cIfNull, SQLFunction\u003e {\n\n  @Override\n  public Optional\u003cSQLFunction\u003e resolve(IfNull expression, ResolutionContext context) {\n    return Optional.of(SQLFunction.create(args -\u003e  \"IFNULL(\" + args.get(0) + \",\" + args.get(1) + \")\"));\n  }\n\t\n}\n\n// Datastore integration\nDatastore datastore = JdbcDatastore.builder().withExpressionResolver(new IfNullResolver()).build();\n\nStream\u003cString\u003e values = datastore.query(TARGET).stream(new IfNull\u003c\u003e(VALUE, \"(fallback)\"));\n```\n\n_JDBC Datastore configuration using Spring:_\n```java\n@EnableJdbcDatastore\n@Configuration\nclass Config {\n\n  @Bean\n  public DataSource dataSource() {\n    return buildDataSource();\n  }\n\n}\n\n@Autowired\nDatastore datastore;\n```\n\n_JDBC 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-jdbc.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\nA JDBC driver which supports the __JDBC API version 4.x__ or above is reccomended to use all the functionalities of the JDBC Datastore.\n\n### Releases\n\nSee [releases](https://github.com/holon-platform/holon-datastore-jdbc/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.jdbc` 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.jdbc\u003c/groupId\u003e\n        \u003cartifactId\u003eholon-datastore-jdbc-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\u003e __NOTE:__ The `holon-datastore-jdbc-composer` artifact requires the Oracle JDBC driver as *optional* dependency to compile the Oracle SQLDialect class. Since the Oracle JDBC driver is not available from Maven Central, to compile the project you should manually download and install it in your local Maven repository or follow the [Oracle Maven repository setup instructions here](https://blogs.oracle.com/dev2dev/get-oracle-jdbc-drivers-and-ucp-from-oracle-maven-repository-without-ides).\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-jdbc.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-jdbc/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.jdbc`\n\nArtifact id | Description\n----------- | -----------\n`holon-datastore-jdbc` | __JDBC__ `Datastore` API implementation\n`holon-datastore-jdbc-composer` | The SQL composer engine based on the Java __JDBC__ API\n`holon-datastore-jdbc-spring` | __Spring__ integration using the `@EnableJdbcDatastore` annotation\n`holon-datastore-jdbc-spring-boot` | __Spring Boot__ integration for JDBC Datastore auto-configuration\n`holon-starter-jdbc-datastore` | __Spring Boot__ _starter_ for the JDBC Datastore auto-configuration\n`holon-starter-jdbc-datastore-hikaricp` | __Spring Boot__ _starter_ for the JDBC Datastore auto-configuration using the [HikariCP](https://github.com/brettwooldridge/HikariCP) _pooling_ DataSource  \n`holon-datastore-jdbc-bom` | Bill Of Materials\n`documentation-datastore-jdbc` | Documentation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholon-platform%2Fholon-datastore-jdbc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholon-platform%2Fholon-datastore-jdbc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholon-platform%2Fholon-datastore-jdbc/lists"}