Note that there are some explanatory texts on larger screens.

plurals
  1. POHQL 42P01: missing FROM-clause entry for table
    primarykey
    data
    text
    <p>HQL query against a PostgreSQL database:</p> <pre><code>var checkLines = _Session.CreateQuery( @"select lines from FinancialStatement statement inner join fetch statement.FinancialStatementLines lines where statement.FinancialStatementId = :statementId and lines.TransactionType = :transactionType and length(lines.CheckNumber) &gt; 0") .SetParameter("statementId", statement.FinancialStatementId) .SetParameter("transactionType", TransactionTypes.Debit) .List&lt;FinancialStatementLine&gt;(); </code></pre> <p>The query looks OK to me, but I am a newbie at HQL. Can someone tell me what I'm doing wrong? I'm assuming the problem is with the HQL, please let me know if you think I need to look elsewhere.</p> <p><strong>THE PLOT THICKENS</strong></p> <p>Upon examining the query created by the above HQL, I discover it looks like this:</p> <pre><code>select financials1_.LineId as LineId14_, financials1_.FinancialStatementId as Financia2_14_, financials1_.APPaymentID as APPaymen3_14_, financials1_.EffectiveDate as Effectiv4_14_, financials1_.Amount as Amount14_, financials1_.TransactionType as Transact6_14_, financials1_.CheckNumber as CheckNum7_14_, financials1_.Description as Descript8_14_, financials1_.VendorDescription as VendorDe9_14_, financials1_.FinancialStatementId as Financia2_, financials1_.LineId as LineId from FinancialStatements financials0_ where financials0_.FinancialStatementId=:p0 and financials1_.TransactionType=:p1 and length(financials1_.CheckNumber)&gt;0 </code></pre> <p>...now, WTF? The <code>select</code> clause aliases don't exist in the <code>from</code> clause, which explains the error, but not, of course, why the error exists.</p> <p>How can I work around this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload