Note that there are some explanatory texts on larger screens.

plurals
  1. POJPQL Exception for composite key
    primarykey
    data
    text
    <p>I am unable to know the solution for 2 JPQL Exception </p> <ol> <li>subquery must return only one column The field</li> <li><code>[PARENTENTITY.PARENTID2]</code> in this expression has an invalid table in this context for following entity --</li> </ol> <hr> <pre><code> class ParentEntity{ @Id String parentId1; @Id String parentId2; @ManyToOne ChildEntity childEntityRef; } </code></pre> <hr> <pre><code> class ChildEntity { @Id String childId1; @Id String childId2; } </code></pre> <hr> <p>when i tried Query - <code>SELECT me.childId1,me.childId2 FROM ChildEntity as me where me &lt;&gt; ALL(Select pe.childEntityRef From ParentEntity as pe where pe.parentId1=:parentId1 and pe.parentId2=:parentId2 )</code> it gives following exception -</p> <pre><code>Caused by: Exception [EclipseLink-6069] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.QueryException Exception Description: The field [PARENTENTITY.PARENTID2] in this expression has an invalid table in this context. at org.eclipse.persistence.exceptions.QueryException.invalidTableForFieldInExpression(QueryException.java:712) at org.eclipse.persistence.internal.expressions.FieldExpression.validateNode(FieldExpression.java:277) at org.eclipse.persistence.expressions.Expression.normalize(Expression.java:2978) at org.eclipse.persistence.internal.expressions.DataExpression.normalize(DataExpression.java:342) at org.eclipse.persistence.internal.expressions.FieldExpression.normalize(FieldExpression.java:205) at org.eclipse.persistence.internal.expressions.CompoundExpression.normalize(CompoundExpression.java:218) </code></pre> <p>when i tried Query - <code>SELECT me.childId1,me.childId2 FROM ChildEntity as me where me &lt;&gt; (Select pe.childEntityRef From ParentEntity as pe where pe.parentId1=:parentId1 and pe.parentId2=:parentId2 )</code> it gives following exception -</p> <pre><code>Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.postgresql.util.PSQLException: ERROR: subquery must return only one column Error Code: 0 Call: SELECT t0.CHILDID1, t0.CHILDID2 FROM CHILDENTITY t0 WHERE ( &lt;&gt; (SELECT t1.CHILDID1, t1.CHILDID2 FROM PARENTENTITY t2 LEFT OUTER JOIN CHILDENTITY t1 ON ((t1.CHILDID2 = t2.CHILDID2) AND (t1.CHILDID1 = t2.CHILDID1)) WHERE ((t2.PARENTID1 = ?) AND (t2.PARENTID2 = ?)))) bind =&gt; [2 parameters bound] Query: ReportQuery(referenceClass=ChildEntity sql="SELECT t0.CHILDID1, t0.CHILDID2 FROM CHILDENTITY t0 WHERE ( &lt;&gt; (SELECT t1.CHILDID1, t1.CHILDID2 FROM PARENTENTITY t2 LEFT OUTER JOIN CHILDENTITY t1 ON ((t1.CHILDID2 = t2.CHILDID2) AND (t1.CHILDID1 = t2.CHILDID1)) WHERE ((t2.PARENTID1 = ?) AND (t2.PARENTID2 = ?))))") at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535) Caused by: org.postgresql.util.PSQLException: ERROR: subquery must return only one column at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327) </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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