Merge pull request #5967 from raman-bt/6464-persona-query-exception

Fixed malformed queries.
This commit is contained in:
Richard Cordovano 2020-06-11 10:09:58 -04:00 committed by GitHub
commit e58cfc59c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -277,7 +277,7 @@ public class PersonaAccount {
public static Collection<PersonaAccount> getPersonaAccountsForAccount(long accountId) throws CentralRepoException { public static Collection<PersonaAccount> getPersonaAccountsForAccount(long accountId) throws CentralRepoException {
String queryClause = PERSONA_ACCOUNTS_QUERY_CALUSE String queryClause = PERSONA_ACCOUNTS_QUERY_CALUSE
+ " WHERE persona_accounts.account_id = " + accountId + " WHERE persona_accounts.account_id = " + accountId
+ "AND p.status_id != " + Persona.PersonaStatus.DELETED.getStatusId(); + " AND personas.status_id != " + Persona.PersonaStatus.DELETED.getStatusId();
CentralRepository cr = CentralRepository.getInstance(); CentralRepository cr = CentralRepository.getInstance();
@ -306,7 +306,7 @@ public class PersonaAccount {
public static Collection<PersonaAccount> getPersonaAccountsForIdentifierLike(String accountIdentifierSubstring) throws CentralRepoException { public static Collection<PersonaAccount> getPersonaAccountsForIdentifierLike(String accountIdentifierSubstring) throws CentralRepoException {
String queryClause = PERSONA_ACCOUNTS_QUERY_CALUSE String queryClause = PERSONA_ACCOUNTS_QUERY_CALUSE
+ " WHERE LOWER(accounts.account_unique_identifier) LIKE LOWER('%" + accountIdentifierSubstring + "%')" + " WHERE LOWER(accounts.account_unique_identifier) LIKE LOWER('%" + accountIdentifierSubstring + "%')"
+ "AND p.status_id != " + Persona.PersonaStatus.DELETED.getStatusId(); + " AND personas.status_id != " + Persona.PersonaStatus.DELETED.getStatusId();
CentralRepository cr = CentralRepository.getInstance(); CentralRepository cr = CentralRepository.getInstance();
if (cr != null) { if (cr != null) {
@ -331,7 +331,9 @@ public class PersonaAccount {
*/ */
public static Collection<PersonaAccount> getPersonaAccountsForAccount(Account account) throws CentralRepoException { public static Collection<PersonaAccount> getPersonaAccountsForAccount(Account account) throws CentralRepoException {
String queryClause = PERSONA_ACCOUNTS_QUERY_CALUSE String queryClause = PERSONA_ACCOUNTS_QUERY_CALUSE
+ " WHERE LOWER(accounts.account_unique_identifier) LIKE LOWER('%" + account.getTypeSpecificID() + "%') AND type_name = '" + account.getAccountType().getTypeName() + "' "; + " WHERE LOWER(accounts.account_unique_identifier) LIKE LOWER('%" + account.getTypeSpecificID() + "%')"
+ " AND type_name = '" + account.getAccountType().getTypeName() + "' "
+ " AND personas.status_id != " + Persona.PersonaStatus.DELETED.getStatusId();
CentralRepository cr = CentralRepository.getInstance(); CentralRepository cr = CentralRepository.getInstance();
if (cr != null) { if (cr != null) {