You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Tore Halset <ha...@ecc.no> on 2022/07/04 21:15:11 UTC

SelectQuery deprecation

Hello.

I see that SelectQuery are deprecated and will be removed. I have searched the mail archive and found the deprecation thread from 2019. Have you moved away from it in a script based manner or have you re-written all the queries by hand? We have a lot of them. This is in our biggest project.

% find . -type f -name \*java -exec grep -H new\ SelectQuery {} \;|wc -l
     546

Regards,
Tore Halset,

Re: SelectQuery deprecation

Posted by Tore Halset <ha...@ecc.no>.
Thank you. I should probably just start.

Tore.

> 5. jul. 2022 kl. 08:47 skrev Andrus Adamchik <aa...@gmail.com>:
> 
> Hi Tore,
> 
> Yeah, that's a big one to change. There's no script that I am aware of, and writing a generic one would probably require to work with the Java syntax AST. SelectQuery uses "Java Bean" style with "void" return type of most methods, while ObjectSelect returns "this" (so it can be changed), and most method names have different names. So you can't just "sed" the constructor.
> 
> At the same time, the benefit of the upgrade would be to clean up the code and start using the new style. So you might start by running search/replace on the constructor, and then clean up the rest by hand.
> 
> Andrus
> 
> 
>> On Jul 4, 2022, at 11:15 PM, Tore Halset <ha...@ecc.no> wrote:
>> 
>> Hello.
>> 
>> I see that SelectQuery are deprecated and will be removed. I have searched the mail archive and found the deprecation thread from 2019. Have you moved away from it in a script based manner or have you re-written all the queries by hand? We have a lot of them. This is in our biggest project.
>> 
>> % find . -type f -name \*java -exec grep -H new\ SelectQuery {} \;|wc -l
>>    546
>> 
>> Regards,
>> Tore Halset,
> 
> 


Re: SelectQuery deprecation

Posted by Andrus Adamchik <aa...@gmail.com>.
> so it can be changed

so it can be *chained* :)

> On Jul 5, 2022, at 8:47 AM, Andrus Adamchik <aa...@gmail.com> wrote:
> 
> Hi Tore,
> 
> Yeah, that's a big one to change. There's no script that I am aware of, and writing a generic one would probably require to work with the Java syntax AST. SelectQuery uses "Java Bean" style with "void" return type of most methods, while ObjectSelect returns "this" (so it can be changed), and most method names have different names. So you can't just "sed" the constructor.
> 
> At the same time, the benefit of the upgrade would be to clean up the code and start using the new style. So you might start by running search/replace on the constructor, and then clean up the rest by hand.
> 
> Andrus
> 
> 
>> On Jul 4, 2022, at 11:15 PM, Tore Halset <ha...@ecc.no> wrote:
>> 
>> Hello.
>> 
>> I see that SelectQuery are deprecated and will be removed. I have searched the mail archive and found the deprecation thread from 2019. Have you moved away from it in a script based manner or have you re-written all the queries by hand? We have a lot of them. This is in our biggest project.
>> 
>> % find . -type f -name \*java -exec grep -H new\ SelectQuery {} \;|wc -l
>>    546
>> 
>> Regards,
>> Tore Halset,
> 


Re: SelectQuery deprecation

Posted by Andrus Adamchik <aa...@gmail.com>.
Hi Tore,

Yeah, that's a big one to change. There's no script that I am aware of, and writing a generic one would probably require to work with the Java syntax AST. SelectQuery uses "Java Bean" style with "void" return type of most methods, while ObjectSelect returns "this" (so it can be changed), and most method names have different names. So you can't just "sed" the constructor.

At the same time, the benefit of the upgrade would be to clean up the code and start using the new style. So you might start by running search/replace on the constructor, and then clean up the rest by hand.

Andrus


> On Jul 4, 2022, at 11:15 PM, Tore Halset <ha...@ecc.no> wrote:
> 
> Hello.
> 
> I see that SelectQuery are deprecated and will be removed. I have searched the mail archive and found the deprecation thread from 2019. Have you moved away from it in a script based manner or have you re-written all the queries by hand? We have a lot of them. This is in our biggest project.
> 
> % find . -type f -name \*java -exec grep -H new\ SelectQuery {} \;|wc -l
>     546
> 
> Regards,
> Tore Halset,