private static Set < OrgLang > selectOrgsWithMultipleDefaultProfiles ( Context context ) throws SQLException { Select rows = context . prepareSelect ( "select organization_uuid, language from rules_profiles " + " where is_default = ? " + " group by organization_uuid, language " + " having count(kee) > 1 " ) . setBoolean ( 1 , true ) ; return new HashSet <> ( rows . list ( row -> new OrgLang ( row . getString ( 1 ) , row . getString ( 2 ) ) ) ) ; }
By design the table rules_profiles does not enforce to have a single profile marked as default for an organization and language . This method returns the buggy rows .