E AE GALERA…SERÁ QUE ALGUEM PODE ME AJUDAR??
CÓDIGO:
package br.com.getnet.acesso;
import net.sf.hibernate.Criteria;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
import net.sf.hibernate.expression.Expression;
import br.com.getnet.models.User;
public class ValidaUsuario extends AcessoBaseUsuario {
private User usuario;
public ValidaUsuario(User usuario){
this.usuario = usuario;
}
public boolean validar() throws Exception {
try {
Session session = createSession();
session.connection().setAutoCommit(true);
Criteria criteria = session.createCriteria(UsuarioWeb.class);
criteria.add(Expression.eq("cdUsuario", usuario.getCodUser()));
criteria.add(Expression.eq("usuario", usuario.getUser()));
criteria.add(Expression.eq("password", usuario.getPass()));
UsuarioWeb usuarioWeb = (UsuarioWeb)criteria.uniqueResult();
session.disconnect();
session.close();
if (usuarioWeb == null) {
return false;
} else {
return true;
}
} catch (HibernateException e) {
e.printStackTrace();
return false;
}
}
}
GERA ESTE ERRO:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.ClassCastException: java.lang.String
net.sf.hibernate.type.IntegerType.set(IntegerType.java:34)
net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:48)
net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:35)
net.sf.hibernate.loader.Loader.bindPositionalParameters(Loader.java:749)
net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:788)
net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
net.sf.hibernate.loader.Loader.list(Loader.java:1024)
net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3648)
net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
net.sf.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:385)
br.com.getnet.acesso.ValidaUsuario.validar(ValidaUsuario.java:41)
action.Login.execute(Login.java:30)
com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:283)
com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:166)
com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116)
com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:272)
com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:237)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.