/** * Method to return if it is valid to select the specified mapping for the specified statement for * this datastore adapter. Sometimes, dependent on the type of the column(s), and what other * components are present in the statement, it may be invalid to select the mapping. This * implementation returns true, so override in database-specific subclass as required. * * @param stmt The statement * @param m The mapping that we want to select * @return Whether it is valid */ public boolean validToSelectMappingInStatement(SelectStatement stmt, JavaTypeMapping m) { if (m.getNumberOfDatastoreMappings() <= 0) { return true; } for (int i = 0; i < m.getNumberOfDatastoreMappings(); i++) { Column col = m.getDatastoreMapping(i).getColumn(); if (col.getJdbcType() == JdbcType.CLOB || col.getJdbcType() == JdbcType.BLOB) { // "The ... data type cannot be selected as DISTINCT because it is not comparable." if (stmt.isDistinct()) { NucleusLogger.QUERY.debug( "Not selecting " + m + " since is for BLOB/CLOB and using DISTINCT"); return false; } else if (stmt.getNumberOfUnions() > 0) { NucleusLogger.QUERY.debug( "Not selecting " + m + " since is for BLOB/CLOB and using UNION"); return false; } } } return true; }