添加的时候没有报错 但是查询的时候报这个错误 org.springframework.orm.hibernate3.HibernateQueryException: lxNews is not mapped [from lxNews]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: lxNews is not mapped [from lxNews]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:657)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:921)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:913)
at com.news.dao.impl.NewsDaoImpl.selectNewsCount(NewsDaoImpl.java:137)
at com.news.service.impl.NewsServicesImpl.selectNewsCount(NewsServicesImpl.java:61)
at com.news.service.impl.NewsServicesImpl$$FastClassByCGLIB$$9082df78.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:657)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:921)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:913)
at com.news.dao.impl.NewsDaoImpl.selectNewsCount(NewsDaoImpl.java:137)
at com.news.service.impl.NewsServicesImpl.selectNewsCount(NewsServicesImpl.java:61)
at com.news.service.impl.NewsServicesImpl$$FastClassByCGLIB$$9082df78.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
解决方案 »
- 批量更新。怎么加事务
- JSP表单提交Action没有反应
- hibernate用sql连接查询,怎么让返回的set里面也是条件查询所查询出来的数据(现在正在做,很着急,请高手帮忙)
- JSP如何传递参数到Flash中?
- 做java的web开发有用过多线程吗
- 求JSP中request.getRealPath()和application.getRealPath()的详尽用法
- 如何用xul调用dll组件?
- 如何用sql语句把输出内容颠倒过来
- 【--------急求助--------】:使用struts的validator过程中ValidatorForm类型转换的问题
- No Dialect mapping fot jdbc type 3
- Struts 国际化 i18N properties 数据动态
- jsp 取值?
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/news">
</property>
<property name="username" value="root">
</property>
<property name="password" value="lx">
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="shou_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/news/model/News.xml</value>
</list>
</property>
</bean>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory">
</property>
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="search*" read-only="true"/>
<tx:method name="query*" read-only="true"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="do*" propagation="REQUIRED"/>
<tx:method name="*" propagation="REQUIRED" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:pointcut expression="execution(* com.news.service..*.*(..))" id="serviceMethod"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"/>
</aop:config>
</beans>
lxNews 这是你要查询的类名? 如果是类的话,要与类名相同,应该首字母大写“LxNews”楼主试试,如果还不行的话把查询方法贴出来看看