Dear all,

For some reasons (I'm pretty sure it has worked in the past), calling:

  anySearchDAO.count(realm, false, SyncopeConstants.FULL_ADMIN_REALMS, cond, 
AnyTypeKind.USER);

fails with:

"
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: (conn=282) Column 
'any_id' in WHERE is ambiguous {prepstmnt 872715940 SELECT COUNT(DISTINCT 
sv.any_id) FROM user_search sv LEFT JOIN user_search_attr sva ON 
sv.any_id=sva.any_id WHERE ((sva.schema_id='u_dateExpirationMotDePasse' AND 
sva.dateValue<?) AND (any_id IS NOT NULL))} [code=1052, state=23000]
"

with the condition "cond" built by:

    protected SearchCond buildSearchCond() {
        LocalDate today = LocalDate.now();
        LocalDate in50days = today.plus(Period.parse("P50D")); // less than P42D
        
        AttrCond expDateCond = new AttrCond(AttrCond.Type.LT);
        expDateCond.setSchema("u_dateExpirationMotDePasse");
        expDateCond.setExpression(in50days.toString());
        
        return SearchCond.getLeaf(expDateCond);
    }


Any idea what could give this SQL query error?

Thanks
Lionel

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to