Hi Lionel,
this is likely due to the changes introduced in 3.0.11 by

https://issues.apache.org/jira/browse/SYNCOPE-1855

The query below should be changed by turning

any_id IS NOT NULL

into

sv.any_id IS NOT NULL

HTH
Regards.

On 01/07/25 11:02, Lionel SCHWARZ wrote:
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

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA
https://about.me/ilgrosso

Reply via email to