title: Liferay Dynamic Subquery on two tables
body: <p>I need to access two attributes from two different tables via dynamic subquery.</p>
  
  <pre><code>create table DLFileVersion (
      uuid_ VARCHAR(75) null,
      fileVersionId LONG not null primary key,
      groupId LONG,
      companyId LONG,
      userId LONG,
      userName VARCHAR(75) null,
      createDate DATE null,
      etc... etc... etc...
      status INTEGER,
      statusByUserId LONG,
      statusByUserName VARCHAR(75) null,
      statusDate DATE null
  );
  </code></pre>
  
  <p>and other table</p>
  
  <pre><code>create table DLFileEntry (
      uuid_ VARCHAR(75) null,
      fileEntryId LONG not null primary key,
      groupId LONG,
      companyId LONG,
      userId LONG,
      userName VARCHAR(75) null,
      version VARCHAR(75) null,
      size_ LONG,
  );
  </code></pre>
  
  <p>I have to find a file by attributes from these two tables, the problem is, that I don't know how to make dynamic subquery with two attributes from DLFileVersion table which are status and userName ... I need to combinate these two attributes with whole DLFileEntry table, to perform a dynamic query using criterions obtained by user from a jsp page. 
  Example:</p>
  
  <pre><code>SELECT DLFileVersion.userName, DLFileEntry.userName, status, version
  FROM DLFileVersion, DLFileEntry
  WHERE ....
  </code></pre>