Hi Giulio,
SelectQuery is replaced with ObjectSelect. But in your case (a query modeled in
the DataMap), you would actually use something else - a MappedSelect query per
https://cayenne.apache.org/docs/4.2/cayenne-guide/#mappedselect-and-mappedexec
MappedSelect.query("attachment", Attachment.class)
.param("reference", aReference)
.param("user", anUser)
.select(context);
Thanks,
Andrus
> On Sep 30, 2025, at 3:15 AM, [email protected] wrote:
>
> Hello everybody,
>
> even if this will force me to admit how old I am, I still have some
> Cayenne 3.0.2 code happily running in production with no issues.
>
> Lately I was trying to upgrade the application from a WAR (running in
> Tomcat) to a standalone application exposing the servlets via Jetty,
> in order to make the application easier to deploy in a docker
> container.
>
> After some struggle to update the model, I am now facing a LOT of
> deprecation warnings like this:
>> [deprecation] SelectQuery in org.apache.cayenne.query has been deprecated
>
> The code I have looks like this:
> -------------------
> prototypeQuery =
> (SelectQuery)dataContext.getEntityResolver().lookupQuery("attachment");
>
> parameters = new HashMap();
> parameters.put("reference", aReference);
> parameters.put("user", anUser);
> query = prototypeQuery.queryWithParameters(parameters);
>
> result = (List<Attachment>)dataContext.performQuery(query);
> -------------------
>
> Unfortunately I never had the opportunity to use any newer version of
> Cayenne, so I haven't followed along with all the changes that it has
> gone through.
>
> Is there anyone willing to suggest me what the above code snippet
> would look like with the new version of Cayenne?
>
> Thanks,
>
> Giulio Cesare