Results 1 to 2 of 2
  1. #1
    colmen is offline Member
    Join Date
    Oct 2012
    Rep Power

    Default Wired problem from hibernate.

    It's new to hibernate,using SSH framework,database is mysql 5,
    I've got weird problem here.
    attach DAO code:
    public List queryUsers(Integer id,String name, String pass,String discrebtion) {
    String hql="from com.User u where and u.pass=?";
    String[] a=new String[]{name,pass};
    System.out.println("usermapdao List queryUsers a :"+a[0]+","+a[1]);
    List tmp1= this.getHibernateTemplate().find(hql,a);
    System.out.println("usermapdao List queryUsers size:"+tmp1.size());
    return tmp1;
    // return this.getHibernateTemplate().find(hql);
    attached the website login.jsp, & got an error:
    <form name="login" action="login.action" method="post">
    <input type="text" name="name" id="name" />
    <input type="text" name="pass" id="pass" />
    <input type="submit" value="submit">
    user0_.ID as ID0_,
    user0_.NAME as NAME0_,
    user0_.PASS as PASS0_,
    user0_.DISCREBTION as DISCREBT4_0_
    user user0_
    and user0_.PASS=?
    java.lang.StringIndexOutOfBoundsException: String index out of range: 4
    at java.lang.String.charAt(
    at com.mysql.jdbc.StringUtils.escapeEasternUnicodeByt eStream(
    at com.mysql.jdbc.StringUtils.getBytesWrapped(StringU
    at com.mysql.jdbc.PreparedStatement.setString(Prepare
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
    at java.lang.reflect.Method.invoke(
    at org.logicalcobwebs.proxool.ProxyStatement.invoke(P
    at org.logicalcobwebs.proxool.ProxyStatement.intercep t(
    at $java.sql.Wrapper$$EnhancerByProxool$$14ff466.setS tring(<generated>)
    at org.hibernate.type.descriptor.sql.VarcharTypeDescr iptor$1.doBind(
    at org.hibernate.type.descriptor.sql.BasicBinder.bind (
    at org.hibernate.type.AbstractStandardBasicType.nullS afeSet(
    at org.hibernate.type.AbstractStandardBasicType.nullS afeSet(
    at org.hibernate.param.PositionalParameterSpecificati on.bind(
    at org.hibernate.loader.hql.QueryLoader.bindParameter Values(
    at org.hibernate.loader.Loader.prepareQueryStatement(
    at org.hibernate.loader.Loader.doQuery( 1)
    at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections(
    at org.hibernate.loader.Loader.doList( 3)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(L
    at org.hibernate.loader.Loader.list(
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoa
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(Que
    at org.hibernate.engine.query.HQLQueryPlan.performLis t(
    at org.hibernate.impl.SessionImpl.list(SessionImpl.ja va:1268)
    at org.hibernate.impl.QueryImpl.list( 02)
    at org.springframework.orm.hibernate3.HibernateTempla te$30.doInHibernate(
    at org.springframework.orm.hibernate3.HibernateTempla te$30.doInHibernate(
    at org.springframework.orm.hibernate3.HibernateTempla te.doExecute(
    at org.springframework.orm.hibernate3.HibernateTempla te.executeWithNativeSession( :374)
    at org.springframework.orm.hibernate3.HibernateTempla te.find(
    at dao.UserMapDao.queryUsers(
    at service.UserService.login(
    at action.LoginAction.execute(

    The weird point is while I'm using the hql like "FROM com.User",without any parameter for "where",it worked well.
    Anyone suffered this problem?
    Last edited by colmen; 10-13-2012 at 08:42 AM. Reason: spelling errors

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Wired problem from hibernate.

    Moved from Advanced Java.

    Cross posted
    weird problem in hibernate |

    Any more?

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Problem with hibernate insert
    By dennisbf in forum New To Java
    Replies: 11
    Last Post: 09-15-2011, 06:25 PM
  2. Hibernate config problem
    By tam in forum JDBC
    Replies: 0
    Last Post: 01-31-2011, 11:28 PM
  3. problem in hibernate
    By jperson in forum JDBC
    Replies: 1
    Last Post: 01-11-2011, 11:10 AM
  4. Hibernate aplication Problem
    By Prashant.surwade in forum Advanced Java
    Replies: 6
    Last Post: 09-18-2009, 10:32 AM
  5. problem in hibernate need help!
    By jrgahan in forum Advanced Java
    Replies: 0
    Last Post: 05-22-2008, 09:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts