Hi,
I am trying to do a simple session.get named query . I am not using hibernate.mapping.xml instead i am using bean configuration

<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSes sionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="packagesToScan" value="com.database.model.SystemParameter"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLS erverDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>

</bean>

I mentioned packages to scan = pojo class where i have named query

@NamedQueries({
@NamedQuery(name = "SystemParameter.findSystemParametsByCode", query = "SELECT s FROM SystemParameter s where s.parameterCode = :parameterCode"),
@NamedQuery(name= "SystemParameter.findSystemValueByCode", query="SELECT s FROM SystemParameter s where s.parameterCode = ?1")
}
)


Dao class:


@Autowired
private SessionFactory sessionFactory;
public List<SystemParameter> fetchInstallmentFailureRecordsUsingSessionFactory( ) {
Session session = sessionFactory.openSession();
Transaction transation = session.beginTransaction();
Query query = session.getNamedQuery("SystemParameter.findSystemP arametsByCode");
query.setString("parameterCode","HOOVERS_TIERED_PR ICING_1");
List<SystemParameter> systemParameter= query.list();
return systemParameter;
}


when running the junit i am getting Mapping exception:

Exception in thread "main" org.hibernate.MappingException: Named query not known: SystemParameter.findSystemParametsByCode
at org.hibernate.internal.AbstractSessionImpl.getName dQuery(AbstractSessionImpl.java:155)
at org.hibernate.internal.SessionImpl.getNamedQuery(S essionImpl.java:1332)
at com.database.dao.impl.InstallmentDaoImpl.fetchInst allmentFailureRecordsUsingSessionFactory(Installme ntDaoImpl.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:198)
at $Proxy20.fetchInstallmentFailureRecordsUsingSessio nFactory(Unknown Source)
at com.database.main.Test.main(Test.java:22)


can any body tell me what i am missing should i need to add another property in like mapping bean in session factory bean