@Test public void getQueryWithIdTest() { final List<Object> preparedStatementValues = new ArrayList<>(); final AssetCategoryCriteria assetCategorySearchWithTenantId = AssetCategoryCriteria.builder() .tenantId("ap.kurnool").id(Long.valueOf(20)).build(); final String queryWithTenantId = "SELECT * FROM egasset_assetcategory assetcategory WHERE assetcategory.tenantId = ? AND " + "assetcategory.id = ? ORDER BY assetcategory.name LIMIT ? OFFSET ?"; assertEquals(queryWithTenantId, assetCategoryQueryBuilder.getQuery(assetCategorySearchWithTenantId, preparedStatementValues)); final List<Object> expectedPreparedStatementValues = new ArrayList<>(); expectedPreparedStatementValues.add("ap.kurnool"); expectedPreparedStatementValues.add(20L); expectedPreparedStatementValues.add(500); expectedPreparedStatementValues.add(Long.valueOf(0)); assertTrue(preparedStatementValues.equals(expectedPreparedStatementValues)); }
public String getQuery(final AssetCategoryCriteria assetCategoryCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(SELECT_BASE_QUERY); addWhereClause(selectQuery, preparedStatementValues, assetCategoryCriteria); addOrderByClause(selectQuery, assetCategoryCriteria); addPagingClause(selectQuery, preparedStatementValues, assetCategoryCriteria); log.info("selectQuery::" + selectQuery); log.info("preparedstmt values : " + preparedStatementValues); return selectQuery.toString(); }
AssetCategoryQueryBuilder { public String getQuery(final AssetCategoryCriteria assetCategoryCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(SELECT_BASE_QUERY); addWhereClause(selectQuery, preparedStatementValues, assetCategoryCriteria); addOrderByClause(selectQuery, assetCategoryCriteria); addPagingClause(selectQuery, preparedStatementValues, assetCategoryCriteria); log.info("selectQuery::" + selectQuery); log.info("preparedstmt values : " + preparedStatementValues); return selectQuery.toString(); } }
AssetCategoryQueryBuilder { public String getQuery(final AssetCategoryCriteria assetCategoryCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(SELECT_BASE_QUERY); addWhereClause(selectQuery, preparedStatementValues, assetCategoryCriteria); addOrderByClause(selectQuery, assetCategoryCriteria); addPagingClause(selectQuery, preparedStatementValues, assetCategoryCriteria); log.info("selectQuery::" + selectQuery); log.info("preparedstmt values : " + preparedStatementValues); return selectQuery.toString(); }  }
AssetCategoryQueryBuilder { public String getQuery(final AssetCategoryCriteria assetCategoryCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(SELECT_BASE_QUERY); addWhereClause(selectQuery, preparedStatementValues, assetCategoryCriteria); addOrderByClause(selectQuery, assetCategoryCriteria); addPagingClause(selectQuery, preparedStatementValues, assetCategoryCriteria); log.info("selectQuery::" + selectQuery); log.info("preparedstmt values : " + preparedStatementValues); return selectQuery.toString(); }  String getQuery(final AssetCategoryCriteria assetCategoryCriteria,
            final List<Object> preparedStatementValues); String getInsertQuery(); String getUpdateQuery(); }
AssetCategoryQueryBuilder { public String getQuery(final AssetCategoryCriteria assetCategoryCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(SELECT_BASE_QUERY); addWhereClause(selectQuery, preparedStatementValues, assetCategoryCriteria); addOrderByClause(selectQuery, assetCategoryCriteria); addPagingClause(selectQuery, preparedStatementValues, assetCategoryCriteria); log.info("selectQuery::" + selectQuery); log.info("preparedstmt values : " + preparedStatementValues); return selectQuery.toString(); }  String getQuery(final AssetCategoryCriteria assetCategoryCriteria,
            final List<Object> preparedStatementValues); String getInsertQuery(); String getUpdateQuery();  }