glassfish
  1. glassfish
  2. GLASSFISH-1792

query compiler's error dianostic can be improved

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.1pe
    • Fix Version/s: not determined
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      1,792

      Description

      Consider following entity
      @Entity
      public class Department
      {

      //@OneToMany(cascade=CascadeType.ALL, mappedBy="department", targetEntity =
      entity.Employee.class)
      // Note that the property is "non-generic"
      public Collection getEmployees()

      { return employees; }

      public void setEmployees(Collection emps)

      { this.employees = (Collection<Employee> )emps; }

      }

      Note that somehow the user has forgotten to annotate the property "employees" as
      OneToMany relationship.

      For the query "select d from Department d join d.employees e where e.address =
      'foo'", we get following exception from the query compiler:

      Exception Description: Invalid navigation expression [e.address], cannot
      navigate expression [e] of type [java.util.Collection] inside a query.
      at
      oracle.toplink.essentials.exceptions.EJBQLException.invalidNavigation(EJBQLException.java:404)
      at
      oracle.toplink.essentials.internal.parsing.DotNode.checkNavigation(DotNode.java:122)
      at oracle.toplink.essentials.internal.parsing.DotNode.validate(DotNode.java:82)
      at oracle.toplink.essentials.internal.parsing.Node.validate(Node.java:100)
      at
      oracle.toplink.essentials.internal.parsing.BinaryOperatorNode.validate(BinaryOperatorNode.java:43)
      at
      oracle.toplink.essentials.internal.parsing.EqualsNode.validate(EqualsNode.java:50)
      at
      oracle.toplink.essentials.internal.parsing.WhereNode.validate(WhereNode.java:43)
      at
      oracle.toplink.essentials.internal.parsing.ParseTree.validate(ParseTree.java:226)
      at
      oracle.toplink.essentials.internal.parsing.ParseTree.validate(ParseTree.java:202)
      at
      oracle.toplink.essentials.internal.parsing.ParseTree.validate(ParseTree.java:192)
      at
      oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateReadQueryInternal(EJBQLParseTree.java:119)
      at
      oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateQuery(EJBQLParseTree.java:93)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:203)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:174)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:138)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:99)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:84)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.<init>(EJBQueryImpl.java:71)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:189)

      It would be preferred if the query compiler flags the error at JOIN clause (d
      join d.employees e) rather than at first access of variable e

        Activity

        Mitesh Meswani created issue -
        kenaiadmin made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 1792 33396
        Tom Mueller made changes -
        Fix Version/s not determined [ 11149 ]
        Fix Version/s 9.1pe [ 10974 ]

          People

          • Assignee:
            mb124283
            Reporter:
            Mitesh Meswani
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: