Hibernate3调用无实体的存储过程
hibernate3调用存储过程,网上其实很多例子了,不过都是有实体表的调用,现在项目有个直接返回几个参数的结果集的,存储过程的调用(sqlserver)。
按照以前的配置方式,老出问题,大多都是列名无效……
后来使用了resultset-ref的配置方式来配置才成功
xml:
<?xml version="1.0"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping><class name="com.born.report.database.data.ByStudent"><composite-id name="id" type="java.lang.String"> <column name="acct_day"/> </key-property> <key-property name="studentName" type="java.lang.String"> <column name="student_name"/> </key-property> <key-property name="reasonTypeName" type="java.lang.String"> <column name="reason_type_name"/> </key-property> <key-property name="subScore" type="java.lang.Double"> <column name="sub_score"/> </key-property> <key-property name="score" type="java.lang.Double"> <column name="score"/> </key-property></composite-id></class><resultset name="bystudent"><return ></return></resultset><sql-query name="pr_qry_learningprocess_bystu_test" resultset-ref="bystudent"><!--<return column="acct_day"/><return-property name="id.studentName" column="student_name" /><return-property name="id.reasonTypeName" column="reason_type_name"/> <return-property name="id.subScore" column="sub_score" /><return-property name="id.score" column="score" /> </return>--><return-scalar column="acct_day" type="java.lang.String" /><return-scalar column="student_name" type="java.lang.String" /><return-scalar column="reason_type_name" type="java.lang.String" /><return-scalar column="sub_score" type="java.lang.Double" /><return-scalar column="score" type="java.lang.Double" />{call pr_qry_learningprocess_bystu_test(?,?,?,?)}</sql-query></hibernate-mapping>
<sql-query name="pr_qry_learningprocess_bystu_test" callable="true">...</sql-query>