title: What does "org.hibernate.DuplicateMappingException: Duplicate query mapping" mean in Hibernate
body: <p>I am trying to run a Spring webapp using hibernate 5.2.16 with struts2-core-2.3.35 on Tomcat8.5 with JDK8. </p>
  
  <p>I am getting the below exception :</p>
  
  <pre><code>Caused by: org.hibernate.DuplicateMappingException: Duplicate query mapping getDocExt
      at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.checkQueryName(InFlightMetadataCollectorImpl.java:524) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.applyNamedQuery(InFlightMetadataCollectorImpl.java:518) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.addNamedQuery(InFlightMetadataCollectorImpl.java:514) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.model.source.internal.hbm.NamedQueryBinder.processNamedQuery(NamedQueryBinder.java:75) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.model.source.internal.hbm.NamedQueryBinder.processNamedQuery(NamedQueryBinder.java:39) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.model.source.internal.hbm.MappingDocument.processNamedQueries(MappingDocument.java:198) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.processNamedQueries(HbmMetadataSourceProcessorImpl.java:94) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processNamedQueries(MetadataBuildingProcess.java:173) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:269) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:691) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
      at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:511) ~[spring-orm-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:495) ~[spring-orm-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1688) ~[spring-beans-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1626) ~[spring-beans-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ~[spring-beans-4.3.15.RELEASE.jar:4.3.15.RELEASE]
      ... 24 more
  
  </code></pre>
  
  <p>When I looked up for this exception, most answers were related to </p>
  
  <pre><code>org.hibernate.DuplicateMappingException: Duplicate class/entity mapping
  </code></pre>
  
  <p>This is different as the exception I am getting does not have "Duplicate class/entity mapping". Instead for me its "Duplicate query mapping".</p>
  
  <p>What could be the reason for getting this exception.</p>