七月 02, 2016 10:08:31 下午 org.hibernate.Version logVersionINFO: HHH000412: Hibernate Core {5.1.0.Final}七月 02, 2016 10:08:31 下午 org.hibernate.cfg.Environment <clinit>INFO: HHH000206: hibernate.properties not found七月 02, 2016 10:08:31 下午 org.hibernate.cfg.Environment buildBytecodeProviderINFO: HHH000021: Bytecode provider name : javassist七月 02, 2016 10:08:32 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureWARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql:///test?useUnicode=true&charaterEncoding=UTF-8]七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001001: Connection properties: {user=root, password=****}七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001003: Autocommit mode: false七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>INFO: HHH000115: Hibernate connection pool size: 20 (min=1)七月 02, 2016 10:08:34 下午 org.hibernate.dialect.Dialect <init>INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect七月 02, 2016 10:08:37 下午 org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateServiceINFO: HHH000397: Using ASTQueryTranslatorFactoryjava.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy33.createQuery(Unknown Source) at service.impl.UsersDAOImpl.uesrsLogin(UsersDAOImpl.java:28) at action.UsersAction.login(UsersAction.java:20) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) at
6 回答
刃殇
TA贡献1条经验 获得超0个赞
package service.impl; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; import db.MyHibernateSessionFactory; import entity.Users; import service.UsersDAO; public class UsersDAOImpl implements UsersDAO{ @Override public boolean uesrsLogin(Users u) { // TODO Auto-generated method stub Transaction tx=null; String hql=""; try { Session session=MyHibernateSessionFactory.getSessionFactory().getCurrentSession(); tx=session.beginTransaction();//开启事务 hql="from Users where username= ? and password= ? "; Query query=session.createQuery(hql); query.setParameter(0, u.getUsername()); query.setParameter(1, u.getPassword()); List list=query.list(); tx.commit(); if (list.size()>0) { return true; } else { return false; } } catch(Exception ex) { ex.printStackTrace(); return false; } finally { if(tx!=null) { tx=null; } } } }
添加回答
举报
0/150
提交
取消