EclipseLink JPQL (Glassfish v3): connection syntax problem?

With Hibernate, I'm used to doing something like the following:

select n from NetworkElement n join fetch n.site s where s.active is true

However, EclipseLink complains a lot about this:

Caused by: Exception [EclipseLink-8024] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.JPQLException Exception Description: Syntax error parsing the query [select n from NetworkElement n join fetch n.site s], line 1, column 49: syntax error at [s].

(The request on the stack is different from the previous one, but the result is the same)

I tried different combinations, none of which worked:

select n from NetworkElement n join fetch n.site where n.site.active is true
select n from NetworkElement n join fetch n.site as site where site.active is true

I also tried switching to another entity in my domain model, suspecting that perhaps my mapping was incorrect. However, the same problem.

Maybe I can achieve this only with a hint? I do not want to do this.

By the way, I use EcliseLink as supplied with Netbeans 6.8 and Glassfish v3.

I would be grateful for any help!

Rodrigo

+3
source share
2 answers

, JPQL fetch, EclipseLink . JPQL, , , . (https://bugs.eclipse.org/bugs/show_bug.cgi?id=293775).

-

+4

, , JPQL JPQL. Hibernate, HQL, HQL JPA.

, . - , orm.xml :

<!-- Fetch network elements -->
<named-query name="fetchNetworkElements">
    <query>select n from NetworkElement n</query>
    <lock-mode>NONE</lock-mode>
    <hint name="eclipselink.join-fetch" value="n.site" />
    <hint name="eclipselink.join-fetch" value="n.site.area" />
</named-query>

, , JPQL.

0

Source: https://habr.com/ru/post/1734096/


All Articles