解决方案 »
- 求教DisplayTag如何实现总列和分列
- hibernate mant-to-one设置属性not-found="ignore"不能延迟加载如何解决?
- <rich:listShuttle/>标签自定义对象的converter怎么写啊?
- ibatis 查询问题
- 问题:如何用程序的方法修改 tomcat-users.xml 里边的用户密码?(兼升级散分)
- 两个java web项目的通信
- 在java中直接中断程序用什么呢?
- J2ee的duke's bank安装配置问题
- 一个著名的逻辑推理题,请大家来思考?
- java 后台代码中的substring截取字符串中第三个;之前的数据
- 项目里spring2.1和spring3的jar包同时存在?
- webservice报错javax.xml.ws.soap.SOAPFaultException: 302
严重: Servlet.service() for servlet [default] in context with path [/MyWork] threw exception [org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [from Customer where custname='asd']] with root cause
org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [from Customer where custname='asd']
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/ql/entity/User.hbm.xml</value>
<value>com/ql/entity/Student.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.show_sql=true
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.cache.use_second_level_cache=true
hibernate.cache.provider_class=org.hibernate.cache.OSCacheProvider
hibernate.generate_statistics=true
hibernate.connection.release_mode=auto
hibernate.autoReconnect=true
</value>
</property>
</bean>
严重: Servlet.service() for servlet [default] in context with path [/MyWork] threw exception [org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [from Customer where custname='asd']] with root cause
org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [from Customer where custname='asd']
以下是我修改后的↓
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="mappingResources">
<list>
<value>vo/Customer.hbm.xml</value></list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
</value>
</property>
</bean>
真心求解,虽然用第二种方式可行,
但是一直身怀一颗打破砂锅问到底的心,况且刚刚接触SSH,对我以后的学习很有用,希望大家发表各自见解,多谢!
<property name="mappingLocations">
<list>
<value>classpath:vo/Customer.hbm.xml</value>
<value>classpath:vo/Customer.hbm.xml</value>
</list>
</property>
<property name="mappingLocations">
<list>
<value>classpath:/你的路径/你的路径/*.hbm.xml</value>
</list>
</property>
试试通配符方式,匹配你某个文件夹下面的所有以 hbm.xml结尾的文件
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
</value>
</property>
<property name="mappingLocations">
<list>
<value>classpath:vo/Customer.hbm.xml</value>
</list>
</property>
</bean>
严重: Servlet.service() for servlet [default] in context with path [/MyWork] threw exception [org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [from Customer where custname='zxc']] with root cause
org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [from Customer where custname='zxc']
at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:181)
at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:110)
at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:277)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)