FINERACT-982 - Completely ditch use of Drizzle JDBC Driver after all
This commit is contained in:
committed by
Petri Tuomola
parent
7b4fcb9549
commit
03a8a9858d
@@ -196,15 +196,8 @@ eclipse
|
||||
sourceSets.main.output.resourcesDir = sourceSets.main.java.outputDir
|
||||
sourceSets.test.output.resourcesDir = sourceSets.test.java.outputDir
|
||||
|
||||
/* Exclude maria db related files for non dev builds */
|
||||
if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) {
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
exclude '**/ServerWithMariaDB*'
|
||||
exclude '**/MariaDB4j*'
|
||||
}
|
||||
}
|
||||
test {
|
||||
java {
|
||||
exclude '**/core/boot/tests/**'
|
||||
@@ -224,7 +217,7 @@ configurations {
|
||||
driver
|
||||
}
|
||||
dependencies {
|
||||
driver 'org.drizzle.jdbc:drizzle-jdbc:1.4'
|
||||
driver 'org.mariadb.jdbc:mariadb-java-client:2.7.3'
|
||||
}
|
||||
|
||||
URLClassLoader loader = GroovyObject.class.classLoader
|
||||
@@ -235,7 +228,7 @@ configurations.driver.each {File file ->
|
||||
task createDB {
|
||||
description= "Creates the Database. Needs database name to be passed (like: -PdbName=someDBname)"
|
||||
doLast {
|
||||
def sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' )
|
||||
def sql = Sql.newInstance( 'jdbc:mariadb://localhost:3306/', mysqlUser, mysqlPassword, 'org.mariadb.jdbc.Driver' )
|
||||
sql.execute( 'create database '+"`$dbName`" )
|
||||
}
|
||||
}
|
||||
@@ -243,13 +236,13 @@ task createDB {
|
||||
task dropDB {
|
||||
description= "Drops the specified database. The database name has to be passed (like: -PdbName=someDBname)"
|
||||
doLast {
|
||||
def sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' )
|
||||
def sql = Sql.newInstance( 'jdbc:mariadb://localhost:3306/', mysqlUser, mysqlPassword, 'org.mariadb.jdbc.Driver' )
|
||||
sql.execute( 'DROP DATABASE '+"`$dbName`")
|
||||
}
|
||||
}
|
||||
task setBlankPassword {
|
||||
doLast {
|
||||
def sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' )
|
||||
def sql = Sql.newInstance( 'jdbc:mariadb://localhost:3306/', mysqlUser, mysqlPassword, 'org.mariadb.jdbc.Driver' )
|
||||
sql.execute('USE `fineract_tenants`')
|
||||
sql.execute('UPDATE fineract_tenants.tenants SET schema_server = \'localhost\', schema_server_port = \'3306\', schema_username = \'mifos\', schema_password = \'mysql\' WHERE id=1;')
|
||||
}
|
||||
@@ -259,6 +252,10 @@ bootRun {
|
||||
jvmArgs = [
|
||||
"-Dspring.output.ansi.enabled=ALWAYS"
|
||||
]
|
||||
|
||||
dependencies {
|
||||
implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.3'
|
||||
}
|
||||
}
|
||||
|
||||
springBoot {
|
||||
|
||||
@@ -54,7 +54,6 @@ dependencies {
|
||||
'org.apache.poi:poi-ooxml-schemas',
|
||||
'org.apache.tika:tika-core',
|
||||
|
||||
'org.drizzle.jdbc:drizzle-jdbc',
|
||||
'org.flywaydb:flyway-core',
|
||||
|
||||
'com.github.librepdf:openpdf',
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.domain;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import org.apache.openjpa.jdbc.sql.BooleanRepresentationFactory;
|
||||
import org.apache.openjpa.jdbc.sql.MySQLDictionary;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class MySQLDictionaryCustom extends MySQLDictionary {
|
||||
|
||||
public MySQLDictionaryCustom() {
|
||||
|
||||
this.supportsSubselect = true;
|
||||
this.booleanRepresentation = BooleanRepresentationFactory.BOOLEAN;
|
||||
this.supportsGetGeneratedKeys = false;
|
||||
this.allowsAliasInBulkClause = true;
|
||||
this.useWildCardForCount = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectedConfiguration(Connection conn) throws SQLException {
|
||||
super.connectedConfiguration(conn);
|
||||
this.supportsSubselect = true;
|
||||
this.supportsGetGeneratedKeys = false;
|
||||
this.allowsAliasInBulkClause = true;
|
||||
this.useWildCardForCount = true;
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -182,13 +182,17 @@ public final class ResultsetColumnHeaderData implements Serializable {
|
||||
}
|
||||
|
||||
private boolean isAnyInteger() {
|
||||
return isInt() || isSmallInt() || isTinyInt() || isMediumInt() || isBigInt() || isLong();
|
||||
return isInt() || isInteger() || isSmallInt() || isTinyInt() || isMediumInt() || isBigInt() || isLong();
|
||||
}
|
||||
|
||||
private boolean isInt() {
|
||||
return "int".equalsIgnoreCase(this.columnType);
|
||||
}
|
||||
|
||||
private boolean isInteger() {
|
||||
return "integer".equalsIgnoreCase(this.columnType);
|
||||
}
|
||||
|
||||
private boolean isSmallInt() {
|
||||
return "smallint".equalsIgnoreCase(this.columnType);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
|
||||
<properties>
|
||||
<property name="openjpa.Compatibility" value="QuotedNumbersInQueries=true"/>
|
||||
<property name="openjpa.jdbc.DBDictionary" value="org.apache.fineract.infrastructure.core.domain.MySQLDictionaryCustom"/>
|
||||
<!--<property name="openjpa.InverseManager" value="true(Action=warn)"/> -->
|
||||
<property name="openjpa.Log" value="slf4j"/>
|
||||
<property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=CASCADE"/>
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
DRIVERCLASS_NAME:org.drizzle.jdbc.DrizzleDriver
|
||||
DRIVERCLASS_NAME:org.mariadb.jdbc.Driver
|
||||
PROTOCOL:jdbc
|
||||
SUB_PROTOCOL:mysql:thin
|
||||
SUB_PROTOCOL:mariadb
|
||||
|
||||
fineract_tenants_driver:org.drizzle.jdbc.DrizzleDriver
|
||||
fineract_tenants_url:jdbc:mysql:thin://localhost:3306/fineract_tenants
|
||||
fineract_tenants_driver:org.mariadb.jdbc.Driver
|
||||
fineract_tenants_url:jdbc:mariadb://localhost:3306/fineract_tenants
|
||||
fineract_tenants_uid:root
|
||||
fineract_tenants_pwd:mysql
|
||||
|
||||
+3
-3
@@ -38,8 +38,8 @@ CREATE TABLE IF NOT EXISTS `topic_subscriber` (
|
||||
CONSTRAINT `fk_topic_has_m_appuser_m_appuser1` FOREIGN KEY (`user_id`) REFERENCES `m_appuser` (`id`)
|
||||
) ENGINE = InnoDB;
|
||||
|
||||
INSERT INTO topic (enabled, entity_type, entity_id, member_type, title) SELECT true, 'OFFICE', o.id as entity_id, UPPER(r.name) as member_type, CONCAT(r.name, ' of ', o.name) as title FROM m_office o, m_role r WHERE o.parent_id IS NULL AND CONCAT(r.name, ' of ', o.name) NOT IN (SELECT title FROM topic);
|
||||
INSERT INTO topic (enabled, entity_type, entity_id, member_type, title) SELECT true, 'OFFICE', o.id as entity_id, UPPER(r.name) as member_type, CONCAT(r.name, ' of ', o.name) as title FROM m_office o, m_role r WHERE o.parent_id IS NULL AND CONCAT(r.name, ' of ', o.name) COLLATE utf8mb4_general_ci NOT IN (SELECT title FROM topic);
|
||||
|
||||
INSERT INTO topic (enabled, entity_type, entity_id, member_type, title) SELECT true, 'BRANCH', o.id as entity_id, UPPER(r.name) as member_type, CONCAT(r.name, ' of ', o.name) as title FROM m_office o, m_role r WHERE o.parent_id IS NOT NULL AND CONCAT(r.name, ' of ', o.name) NOT IN (SELECT title FROM topic);
|
||||
INSERT INTO topic (enabled, entity_type, entity_id, member_type, title) SELECT true, 'BRANCH', o.id as entity_id, UPPER(r.name) as member_type, CONCAT(r.name, ' of ', o.name) as title FROM m_office o, m_role r WHERE o.parent_id IS NOT NULL AND CONCAT(r.name, ' of ', o.name) COLLATE utf8mb4_general_ci NOT IN (SELECT title FROM topic);
|
||||
|
||||
INSERT INTO topic_subscriber( user_id, topic_id, subscription_date ) SELECT u.id AS user_id, t.id AS topic_id, NOW() FROM topic t, m_appuser u, m_appuser_role ur, m_role r WHERE u.office_id = t.entity_id AND u.id = ur.appuser_id AND ur.role_id = r.id AND r.name = t.member_type AND NOT EXISTS (SELECT user_id, topic_id FROM topic_subscriber WHERE user_id = u.id AND topic_id = t.id);
|
||||
INSERT INTO topic_subscriber( user_id, topic_id, subscription_date ) SELECT u.id AS user_id, t.id AS topic_id, NOW() FROM topic t, m_appuser u, m_appuser_role ur, m_role r WHERE u.office_id = t.entity_id AND u.id = ur.appuser_id AND ur.role_id = r.id AND r.name COLLATE utf8mb4_general_ci = t.member_type AND NOT EXISTS (SELECT user_id, topic_id FROM topic_subscriber WHERE user_id = u.id AND topic_id = t.id);
|
||||
|
||||
@@ -44,7 +44,7 @@ INSERT INTO `m_appuser`
|
||||
VALUES (NULL, 0, 1, NULL, @interop_username, 'Interop', 'User', '5787039480429368bf94732aacc771cd0a3ea02bcf504ffe1185ab94213bc63a',
|
||||
'email@email.com', b'0', b'1', b'1', b'1', b'1', CURDATE(), 0, b'0');
|
||||
|
||||
INSERT INTO `m_appuser_role` VALUES ((SELECT id FROM m_appuser WHERE username = @interop_username), 1);
|
||||
INSERT INTO `m_appuser_role` VALUES ((SELECT id FROM m_appuser WHERE username COLLATE utf8mb4_general_ci = @interop_username), 1);
|
||||
|
||||
-- Interoperation permissions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user