20:27:26,093 ERROR XMLHelper:59 - Error parsing XML: XML InputStream(16) Attribute "callable" must be declared for element type "sql-query".
20:27:26,093 ERROR XMLHelper:59 - Error parsing XML: XML InputStream(18) Element type "return-property" must be declared.
20:27:26,093 ERROR XMLHelper:59 - Error parsing XML: XML InputStream(19) Element type "return-property" must be declared.
20:27:26,109 ERROR XMLHelper:59 - Error parsing XML: XML InputStream(20) The content of element type "return" must match "EMPTY"
上面是报的错下面是*。hbm。xml
<sql-query name="cardlist" callable="false">
<return alias="card" class="com.model.IdCard">
<return-property name="id" column="id"/>
<return-property name="cardnum" column="cardnum"/>
</return>
                   {call *()}
</sql-query>

解决方案 »

  1.   

    这是java  Session session = null;
    Transaction tx = null;
    try {
    session = HibernateUtil.getSession();
    tx = session.beginTransaction();
    Object o=new IdCard();
    System.out.println("+++++++");
    Query query=session.getNamedQuery("cardlist");
    System.out.println(query.list().size()+"--------");
    } catch (Exception e) {
    e.printStackTrace();
    tx.rollback();
    } finally {
    HibernateUtil.close();
    }
    }
      

  2.   

    Session session = this.getSessionFactory().getCurrentSession();
    try
    {
    Connection con = session.connection();
    con.setAutoCommit(true);
    CallableStatement call = con.prepareCall("{Call S_B(?)}");
    call.setInt("agentId", (int) agent.getId());
    call.execute();
    call.close();
    con.commit();
    con.close();
    }catch(Exception ex){}
    finally{
    }直接这么调用就行了 无需配置*.hbm 最直观 最方便!
      

  3.   

    参考我空间有hibernate调用存储过程的例子
      

  4.   

    看看你xml 里面是否有 未声明的变量或者变量和你 的java 文件、jsp 文件不一致的。
    当然还有看你的类型,是不是xml 里的和类里声明的不一致;
      

  5.   

    哈哈 问题解决,就是hibernate的jar的版本低了点