Pergunta

I am using below code

Transaction transaction = Transaction.current();
        SelectQuery<Record> selectQuery = transaction.selectQuery();
        selectQuery.addSelect(Folder.FOLDER.FOLDER_RSN, Routines.fFoldernumber(Folder.FOLDER.FOLDER_RSN).as("FolderNumber"),
                Folder.FOLDER.FOLDER_NAME, Folder.FOLDER.FOLDER_TYPE);
selectQuery.addFrom(FolderPeople.FOLDER_PEOPLE);

Now i want to add OrderBy on FolderNumber Something like below

selectQuery.addOrderBy("FolderNumber")

How to add OrderBy in the above case?

Foi útil?

Solução

The stored functions generated by jOOQ implement org.jooq.Field, so you can simply add them to the ORDER BY clause:

selectQuery.addOrderBy(fFoldernumber(...));

Instead of repeating the whole call, you might also want to consider creating a local reference of your stored function call:

Field<?> folder = Routines.fFoldernumber(Folder.FOLDER.FOLDER_RSN).as("FolderNumber");
// ...
selectQuery.addSelect(..., folder);
selectQuery.addOrderBy(folder);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top