spring-framework-3.1.1.RELEASE
spring-security-3.1.0.RELEASE
spring-flex-1.5.2.RELEASE
hibernate-distribution-3.6.10.Final
I am attempting to run some unit tests on my spring web app.
app-config.xml
My DAO method:Code:<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="mappingResources"> <value>com/crm/hibernate/mapping/resources/*.hbm.xml</value> </property> <property name="dataSource" ref="dataSource"/> <property name="persistenceProviderClass" value="org.hibernate.ejb.HibernatePersistence"/> <property name="packagesToScan" value="com.crm.model.entity" /> </bean>
HBMCode:@SuppressWarnings("unchecked") public List<ProductModel> teste()throws DAOException{ return entityManager.createNamedQuery("hql.product.all").getResultList(); }
I recieve the error :Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping > <query name="hql.product.all">from ProductModel</query> </hibernate-mapping>
Code:java.lang.IllegalArgumentException: Named query not found: hql.product.all at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:619) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.lang.reflect.Method.invoke(Method.java:597)


Reply With Quote
