Skip to content
This repository was archived by the owner on Nov 11, 2022. It is now read-only.
This repository was archived by the owner on Nov 11, 2022. It is now read-only.

Allow subclasses to override query-templates used #1

Description

@fabianbuch

Currently the queries are defined as constants within @JdbcMessageProvider@:


    private static final String QUERY_INSERT = "INSERT INTO %s (%s, %s, %s, %s, %s, %s) VALUES (?, ?, ?, ?, ?, ?)";
    private static final String QUERY_DELETE = "DELETE FROM %s WHERE %s = ?";
    private static final String QUERY_SELECT_BASENAMES = "SELECT DISTINCT %s from %s";
    private static final String QUERY_SELECT_MESSAGES = "SELECT %s,%s,%s,%s,%s FROM %s WHERE %s = ?";

Reading those should be wrapped in protected metods like:


protected String getSelectMessagesQuery() {
  return QUERY_SELECT_MESSAGES;
}

So users could customize the queries by doing the following in a subclass:


@Override
protected String getSelectMessagesQuery() {
  return super.getSelectMessagesQuery() + " WHERE account = 2";
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions