code
docs
tests
This extension fully leverage the SQL Library meaning that you must use it to assemble your DataSource and that you get Circuit Breaker and JMX integration for free.
See the SQL Support Sample that demonstrate combined use of SQL Library, SQL EntityStore and SQL Index/Query.
The following SQL databases are supported:
Implementations per database Vendor share a generic codebase but can override about everything SQL. As a consequence they can have strong differences in terms of performance if they use vendor specific extensions.
Table 75. Artifact
Group ID | Artifact ID | Version |
---|---|---|
org.apache.zest.extension | org.apache.zest.extension.indexing-sql | 0 |
SQL Index/Query Configuration is optional and provides only one configuration property: schemaName
defaulted to
zest_es. On SQL databases that don’t support schemas this configuration property is simply ignored.
The assembly snippets below show the DataSource assembly alongside the SQL Index/Query assembly. Remember to configure the DataSource properly, see SQL Library and Configure a Service.
Assembly is done using the provided Assembler:
// DataSourceService new DBCPDataSourceServiceAssembler(). identifiedBy( "postgres-datasource-service" ). visibleIn( Visibility.module ). withConfig( config, Visibility.layer ). assemble( mainModule ); // DataSource new DataSourceAssembler(). withDataSourceServiceIdentity( "postgres-datasource-service" ). identifiedBy( "postgres-datasource" ). visibleIn( Visibility.module ). withCircuitBreaker(). assemble( mainModule ); // SQL Index/Query new PostgreSQLIndexQueryAssembler(). visibleIn( Visibility.module ). withConfig( config, Visibility.layer ). assemble( mainModule );
Sample DataSource configuration defaults:
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # enabled=true url=jdbc:postgresql://localhost:5432/jdbc_test_db driver=org.postgresql.Driver username=jdbc_test_login password=password
The PostgreSQL ltree extension is needed on the used database, see below how to install it on your database.
It’s bundled with PostgreSQL but you need to activate it on your database:
CREATE EXTENSION ltree;
You need to install postgresql-contrib and import the module in your database. The following applies to Debian based distributions, adapt it to yours:
For example to install the needed ltree module:
psql -U postgres -d database_name -f ltree.sql