Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] JPQL + JOIN + SELECT IN

In this expression:

(job.nameId=dep.targetNameId)

What is the goal. Are you trying to limit the results to jobs that successfully join to the table for dep?

There may be a bug here:

Some things you could try to narrow it down:

- see the the query runs without the last part:  and (job.nameId=dep.targetNameId)
- reorder to put (job.nameId=dep.targetNameId) before the subquery


Assume there is a bug, you may be able to work around it by Mapping a relationship from job to dep and making it LAZY? That way it will not be retrieved unless you want it to be and it will be easy to build queries?

AnaTatavu wrote:
Job and Dependency tables don't have the foreign key set.
The dependeby table has 2 fields I am intrested in source_job_id and
target_job_id
I don't want to set the foreign key constraints for performance reasons,
this is failry rare operation.

tware wrote:
What are you trying to actually do?  I see "dep" only referenced at the
end - which seems to me to be trying to do some kind of cartesian product. Do you really mean something like:

Select Object(job) FROM EntityJob job JOIN job.dependency dep.......

-Tom

AnaTatavu wrote:
I am trying to issue the next JPQL query:
SELECT Object(job) FROM EntityJob job, Dependency dep WHERE (job
IN(SELECT
Object(j) FROM EntityJob j where j.jobName = 'TG_HTTP_JOB1')) and
(job.nameId=dep.targetNameId)


Exception Description: Syntax error parsing the query [
SELECT Object(job) FROM EntityJob job, Dependency dep WHERE (job
IN(SELECT
Object(j) FROM EntityJob j where j.jobName = 'TG_HTTP_JOB1')) and
(job.nameId=dep.targetNameId)], line 1, column 62: unexpected token [(].
Internal Exception: NoViableAltException(69!=[593:1: conditionalPrimary
returns [Object node] : ( ( LEFT_ROUND_BRACKET conditionalExpression )=>
LEFT_ROUND_BRACKET n= conditionalExpression RIGHT_ROUND_BRACKET | n=
simpleConditionalExpression );])
at
org.eclipse.persistence.exceptions.JPQLException.unexpectedToken(JPQLException.java:365)


I tried to remove the ( and I got a different exception.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users





Back to the top