使用AliasToBeanResultTransformer时出错

时间:2014-04-25 18:33:17

标签: hibernate hql criteria

我正在使用下面的AliasToBeanResultTransformer,但它在抛出一个无效的列名称时抛出异常,下面是我的代码请告知如何克服这个

Session session = ((HibernateSessionImpl) this.session).getSession();

String Sql = ""
                + "SELECT a_system, "
                + "       c_id, "               //column name written in table in DB
                + "       t_id, "               //column name written in table in DB
                + "       l_id "                //column name written in table in DB  
                + "FROM   ilogger ";            //column name written in table in DB


          List<IOAPublishingRulesDetails> uy = (List<IOAPublishingRulesDetails>) session
            .createSQLQuery(Sql)
            .addScalar("asystem", Hibernate.STRING) //column namew riiten in this way in pojo
            .addScalar("cid", Hibernate.STRING) //column namew riiten in this way in pojo
            .addScalar("tId", Hibernate.LONG)//column namew riiten in this way in pojo
            .addScalar("lid", Hibernate.STRING)//column namew riiten in this way in pojo
            .setResultTransformer(
              new AliasToBeanResultTransformer(IOAPublishingRulesDetails.class)).list();

          System.out.println(uy.size());

FOLKS请建议任何帮助都会得到很多赞赏。谢谢你提前

下面是异常的堆栈跟踪

Caused by: java.sql.SQLException: Invalid column name
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)

0 个答案:

没有答案