0 Replies Latest reply on Jan 3, 2006 5:25 AM by Martin Heinemann

    SQL Error produced by NamedQuery

    Martin Heinemann Newbie

      I discovered a strange SQL statement.
      I created a named query to search by a given collection

       queryString="SELECT OBJECT(o) FROM PrscMainDrug o WHERE o.prscDrugCategories = :prscDrugCategories")

      Every drug is in one ore more categories. So i wanted to search the drugs which are in a special collection of categories.

      When i tryied to call the query i got an JDBCException caused by an invalid SQL statement:
      10:58:12,807 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 42601
      10:58:12,807 ERROR [JDBCExceptionReporter] FEHLER: Fehler »syntax error« bei ».«

      The statement, i took this from the postgres 7.4 log:
       where prscmaindr0_.pmd_id=prscdrugca1_.pmd_id and prscdrugca1_.pdc_i
      d=prscdrugca2_.pdc_id and .=1

      I can't figure out why there is ".=1".

      The two tables drugs and categories are mapped by a third one for the n2m relation contains only the composed PK of the ids of the two tables.

      Is this a Hibernate problem ore just a jdbc issue?
      Or am i doing something wrong?

      I'm using
      JBoss 4.0.3SP1
      Postgres 7.4