OpenJPA
  1. OpenJPA
  2. OPENJPA-570

Misleading "Found duplicate query" warning message

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0
    • Fix Version/s: 1.1.0, 1.2.0
    • Component/s: query
    • Labels:
      None

      Description

      Even when unique @NamedQuery is defined in application, the following misleading warning message (sample) is posted in the log:

      openjpa.MetaData - Found duplicate query "getEmployeeOrdered" in "class employee.list.Employee". Ignoring.

      This message should only be used when duplicated @NamedQuery definitions are found.

      The reason this message is posted is because the same entity is being "parsed" twice, once from:

      AnnotationPersistenceMappingParser(AnnotationPersistenceMetaDataParser).parseNamedQueries(AnnotatedElement, NamedQuery...) line: 1571
      AnnotationPersistenceMappingParser(AnnotationPersistenceMetaDataParser).parseClassAnnotations() line: 547
      AnnotationPersistenceMappingParser(AnnotationPersistenceMetaDataParser).parse(Class) line: 352
      PersistenceMappingFactory(PersistenceMetaDataFactory).load(Class, int, ClassLoader) line: 229
      MappingRepository(MetaDataRepository).getQueryMetaDataInternal(Class, String, ClassLoader) line: 1664
      MappingRepository(MetaDataRepository).getQueryMetaData(Class, String, ClassLoader, boolean) line: 1603
      EntityManagerImpl.createNamedQuery(String) line: 97
      EntityManagerImpl.createNamedQuery(String) line: 37

      and subsequently from:

      AnnotationPersistenceMappingParser(AnnotationPersistenceMetaDataParser).parseNamedQueries(AnnotatedElement, NamedQuery...) line: 1571
      AnnotationPersistenceMappingParser(AnnotationPersistenceMetaDataParser).parseClassAnnotations() line: 547
      AnnotationPersistenceMappingParser(AnnotationPersistenceMetaDataParser).parse(Class) line: 352
      PersistenceMappingFactory(PersistenceMetaDataFactory).load(Class, int, ClassLoader) line: 229
      MappingRepository(MetaDataRepository).getMetaDataInternal(Class, ClassLoader) line: 475
      MappingRepository(MetaDataRepository).getMetaData(Class, ClassLoader, boolean) line: 295
      MappingRepository(MetaDataRepository).getMetaData(String, ClassLoader, boolean) line: 364
      QueryImpl.classForName(String, String[]) line: 1563
      ExpressionStoreQuery$1.classForName(String, String[]) line: 108
      JPQLExpressionBuilder.getClassMetaData(String, boolean) line: 168
      JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder$JPQLNode) line: 139
      JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder$JPQLNode) line: 225
      JPQLExpressionBuilder.getCandidateMetaData() line: 195
      JPQLExpressionBuilder.getCandidateType() line: 188
      JPQLExpressionBuilder.access$600(JPQLExpressionBuilder) line: 69
      JPQLExpressionBuilder$ParsedJPQL.populate(ExpressionStoreQuery) line: 1749
      JPQLParser.populate(Object, ExpressionStoreQuery) line: 56
      JDBCStoreQuery(ExpressionStoreQuery).populateFromCompilation(Object) line: 153
      QueryImpl.newCompilation() line: 657
      QueryImpl.compilationFromCache() line: 638
      QueryImpl.compileForCompilation() line: 604
      QueryImpl.compileForExecutor() line: 666
      QueryImpl.compile() line: 573
      EntityManagerImpl.createNamedQuery(String) line: 105
      EntityManagerImpl.createNamedQuery(String) line: 37

      Albert Lee.

        Activity

        Hide
        Albert Lee added a comment -

        Model after the AnnotationPersistenceMetaDataParser.parsePackageAnnotations(), an extra test is performed in parseClassAnnotations() method for the Named*Quer* annotations to see if the MODE_QUERY has been performed before by examining the meta.getSourceMode() before the actualNamed*Queries() method is invoked.

        This is not a functional but serviceability and performance correction.

        Albert Lee.

        Show
        Albert Lee added a comment - Model after the AnnotationPersistenceMetaDataParser.parsePackageAnnotations(), an extra test is performed in parseClassAnnotations() method for the Named*Quer* annotations to see if the MODE_QUERY has been performed before by examining the meta.getSourceMode() before the actualNamed*Queries() method is invoked. This is not a functional but serviceability and performance correction. Albert Lee.

          People

          • Assignee:
            Albert Lee
            Reporter:
            Albert Lee
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development