实际上是Dialect 不对。。使用什么数据库? 一定要用该数据库的Dialect还有,将ShowSql 打开select person0_.personid as x0_0_, person0_.name as x1_0_, person0_.email as x2_0_, author1_.alias as x3_0_ from person person0_, author author1_ where (person0_.personid=author1_.id )and(person0_.name=? )
去掉0_  在数据库里直接运行,,,看数据库是否支持这样的语法。(不过应该是支持的。)

解决方案 »

  1.   

    to  totodo(土豆仙) 我的配置文件里都配置了的,如:<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost/good?</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password"></property>
    <property name="hibernate.connection.pool.size">20</property>
    <property name="hibernate.show_sql">true</property>
    <property name="jdbc.fetch_size">50</property>
    <property name="jdbc.batch_size">25</property>
    <property name="jdbc.use_scrollable_resultset">false</property>
    <property name="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</property>应该没有问题,是不是其他地方有问题??????
      

  2.   

    我刚才在数据库中试了;select person.personid , person.name, person.email, author.alias from person person, author author where (person.personid=author.id )and(person.name="niyong" )
    能够执行,并且能得到结果;我想应该是其他问题吧
      

  3.   

    String queryString = "select person,author from goodok.Person as person ,goodok.Author as author where person.personid=author.id and person.name = :name  " ;
    beginTransaction();Query query = session.createQuery(queryString);
    query.setString("name", name);
    Iterator it= query.iterate();
    while(itr.hasNext(){
      Object[] tuple=(Object[])itr.next();
      Person person=tuple[0];
      Author author=tuple[1];
    }
      

  4.   

    到官方站去看看嘛
    http://www.hibernate.org.cn/
      

  5.   

    to swj_20(不吃东瓜)我在JSP页面这样改了:String name=request.getParameter("name");
    Iterator it=pb.getSomePerson(name);
    while(it.hasNext())
    { Object[] tuple=(Object[])it.next();
      Person person=tuple[0];       //at line 27
      Author author=tuple[1];       //at line 28
    }出现了这样的错误:"test1.jsp": Error #: 354 : incompatible types; found: java.lang.Object, required: goodok.Person at line 27"test1.jsp": Error #: 354 : incompatible types; found: java.lang.Object, required: goodok.Author at line 28
      

  6.   

    jsp本身就有问题。
    Person person=(Person)tuple[0];       //at line 27
    Author author=(Author)tuple[1];       //at line 28
    另外把两个类和hbm的文件都放出来。楼主上面不够详细