解决方案 »

  1.   

    hibernate如果指定了要查询的字段的话 返回的就是一个数组集合 一个数组里面就是你指定的那些字段 
      

  2.   

    把new去了,想要哪个字段可以直接写在select后面
      

  3.   

    把new去掉也不行啊public static void main(String[] args) {
    Session session=HibernateSessionFactory.getSessionFactory().getCurrentSession();
    Transaction tx=session.beginTransaction();
    List<Object[]> objs=session.createSQLQuery("select s.xh,s.xm,s.zymc,p.prizeOption,p.schoolYear from jxj_PrizeInfo p,t_main s where p.studentID=s.xh").list();
    tx.commit();
    }然后就报错了Exception in thread "main" org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
    at org.hibernate.dialect.TypeNames.get(TypeNames.java:76)
    at org.hibernate.dialect.TypeNames.get(TypeNames.java:99)
    at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:592)
    at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:696)
      

  4.   

    你这个报错是说的没有配置好方言 是不是hibernate配置文件配的有问题