Named query not known no hibernate

Pessoal, recebo a seguinte mensagem de erro ao tenytar utilizar uma query num hbm.xml:

Named query not known: pontosControleByLinCod; nested exception is org.hibernate.MappingException: Named query not known: pontosControleByLinCod

chamo a query da seguinte maneira:

public class TVitLinhaControleDAOHibernate extends BaseDAOHibernateImpl implements BaseDAOHibernate {
	public List findPontosControleByLinCod (Long parameter) throws Exception {
		return findByNamedQuery("pontosControleByLinCod", parameter);	
	}
}

a query está no arquivo TVitLinhaControle.hbm.xml:

	    <query name="pontosControleByLinCod">
			select tp
			from TVitPontoControle tp, TVitLinhaControle lc
			where tp.isPontoControle  = lc.isPontoControle
			and lc.linCod = ?
	    </query>

e essa arquivo eu mapeio no spring-config.xml

	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref local="dataSource" />
		</property>
		<property name="mappingResources">
			<list>
							<value>br/com/checkrota/srv/model/vitoria/TVitLinhaControle.hbm.xml</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
				<prop key="hibernate.default_schema">findnet</prop>
				<!-- <prop key="hibernate.query.substitutions">true 1, false 0</prop> -->
				<prop key="hibernate.show_sql">false</prop>
				<prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
				<prop key="hibernate.c3p0.min_size">1</prop>
				<prop key="hibernate.c3p0.max_size">100</prop>
				<prop key="hibernate.c3p0.timeout">600</prop>
				<prop key="hibernate.c3p0.max_statements">50</prop>
				<prop key="hibernate.c3p0.idle_test_period">60</prop>
			</props>
		</property>
	</bean>

enfim, alguém pode dar uma luz no que tenho q resolver pra query ser executada???

a outros mapeamentos que retirei de arquivos .hbm.xml que retirei para nao ficar muito extenso…

Olá,

Eu sofir durante vinte horas para encontrar a solução desse erro. É o seguinte: o Hibernate, em integração com o Spring, as query named DEVEM SER COLOCADAS FORA DA TAG class, como a seguir:

<?xml version="1.0" encoding="UTF-8"?> ...

Veja que eu estou usando a DTD do Hibernate 3.0. Além disso, ao fazer a integração com o Spring, faço uso do HibernateDaoSupport, como a seguir

public class Repository extends HibernateDaoSupport {

public Setor getSetor(Integer id) {
return (Setor) getHibernateTemplate().getNamedQueryAndNamedParam(“setor”, new String[]{“id”}, new Object[]{id}).get(0);
}

}