Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    JPQL syntax error parsing select count

    I'm using JPA2DataSource with a SmartGWT 3.1p Pro and it is throwing this exception (with 3.0p version it was perfectly ok).

    Code:
    Exception [EclipseLink-0] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.JPQLException
    Exception Description: Syntax error parsing [select count(*) from VwUserVehicleHistory _VwUserVehicleHistory where (_VwUserVehicleHistory.eventType = :p0 and _VwUserVehicleHistory.eventType is not null and (_VwUserVehicleHistory.status <> :p1 or _VwUserVehicleHistory.status is null) and _VwUserVehicleHistory.user = :p2 and _VwUserVehicleHistory.user is not null and _VwUserVehicleHistory.type = :p3 and _VwUserVehicleHistory.type is not null and (_VwUserVehicleHistory.destinyClientId is null or _VwUserVehicleHistory.destinyClientId = :p4 and _VwUserVehicleHistory.destinyClientId is not null))]. 
    [13, 13] The left expression is missing from the arithmetic expression.
    [14, 14] The right expression is missing from the arithmetic expression.
    	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:150)
    	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:325)
    	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:270)
    	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:157)
    	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:138)
    	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:112)
    	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:98)
    	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:82)
    	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1510)
    	at com.isomorphic.jpa.JPADataSource.createQuery(JPADataSource.java:1212)
    	at com.isomorphic.jpa.JPADataSource.executeFetch(JPADataSource.java:584)
    	at com.isomorphic.datasource.DataSource.execute(DataSource.java:1368)
    	at com.isomorphic.jpa.JPADataSource.execute(JPADataSource.java:543)

    As far as I know "count(*)" is not a valid construct in JPQL.

    Any help is welcome.

    Best regards,
    Heleno
    Last edited by helenov; 28 Nov 2012, 07:03.

    #2
    Hello helenov,

    count(*) is neither valid nor invalid in JPQL. Hibernate and other providers support it but it looks like EclipseLink doesn't. We'll see if we can work around this.

    Comment


      #3
      Just registring: I've just tried 4.0d 2012-11-28 and it has the same problem.

      3.0p was ok (but I need the upgrade to solve another problem).

      Comment


        #4
        Hello helenov, this has now be fixed, with the drawback that composite primary keys won't be supported for JPA with EclipseLink (they don't support sufficient syntax for this to be possible with an efficient implementation).

        Comment

        Working...
        X