JOOQ - Recursive Query

64
June 25, 2021, at 1:30 PM

I have the following database structure:

File

  • file_id
  • file_name
  • folder_id

Folder

  • folder_id
  • folder_name
  • parent_folder_id

I'm trying to dynamic build the file path this way:

Query: - This returns the file and the folder where is located.

dsl.select()
   .from( FILE)
   .join( FOLDER)
   .on( FILE.FOLDER_ID.eq( FOLDER.FOLDER_ID) )
   .fetch();

And then I get the parent folders in simple Java:

List<Folder> parentFolders= new ArrayList<>();
Long parentFolderId = record.get( FOLDER.PARENT_FOLDER_ID );
while ( parentFolderId != null )
{
    Folder parentFolder = folderService.get(parentFolderId );
    parentFolders.add( 0, parentFolder );
    parentFolderId = parentFolder.getParentFolderId();
}

Output would look like this for instance:

Folder -> Folder -> Folder -> File

To maybe be fetched in a class like this:

Long fileId;
String fileName;
Long fileId;
String fileName;
List<Folder> parents;

Is there any way to do this two steps in JOOQ? The idea is to write a query that does as well the lookup for the parent folders. Is this even possible just with JOOQ?

READ ALSO
Python script that notifies me when there&#39;s an available train seat

Python script that notifies me when there's an available train seat

I am trying to write a python script that allows me to see if any of the sold-out train tickets are back available (that is when someone decides to return their ticket)

47
Dynamically finding TypeScript object values through passed in parameters

Dynamically finding TypeScript object values through passed in parameters

not sure if the title is misleading or actually is asking what I want: I am trying to get an Object's element value, but the tricky thing is that the element's name is being passed in through a function

69
How to calculate the SINR of the LTE in android programmatically?

How to calculate the SINR of the LTE in android programmatically?

I have browsed regrading the calculation of SINR in LTE in android documentationbut I haven't found any resources regrading that

73
Importing a file to a web page [SELENIUM]

Importing a file to a web page [SELENIUM]

I am creating a selenium script to automatically log in to a webpage, and then import axls file

32