ssh2整合问题
是一个用户登录界面:
applicationContext.xml代码如下
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.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/test"></property>
<property name="username" value="root"></property>
<property name="password" value="123"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="packagesToScan">
<list>
<value>org</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${dialect}</prop>
<prop key="hibernate.show_sql">${show_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hbm2ddl_auto}</prop>
<prop key="hibernate.format_sql">${format_sql}</prop>
</props>
</property>
</bean>
<bean id="login" class="org.LoginAction">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
</beans>
User.hbm.xml代码:
<?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">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="org.User" table="user" catalog="test">
<id name="id" type="java.lang.Integer">
<column name="Id"/>
<generator class="native"/>
</id>
<property name="username" type="java.lang.String">
<column name="username" length="10" not-null="true"/>
</property>
<property name="password" type="java.lang.String">
<column name="password" length="10" not-null="true"/>
</property>
</class>
</hibernate-mapping>
hibernate.cfg.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/test
</property>
<property name="connection.username">root</property>
<property name="connection.password">123</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="myeclipse.connection.profile">mysql</property>
<mapping resource="org/User.hbm.xml"/>
</session-factory>
</hibernate-configuration>
下面是工程目录
登录界面是有的,输入用户名和密码之后就出现
org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped [from User u where u.username=? and u.password=?]错误了,求解怎么解决,弄了好半天了,快崩溃了