Hibernate呼叫oracle存储过程,遇到Mapping问题

用hibernate 呼叫oracle的存储过程,返回的结果集需要映射到一个pojo..
返回游标中的数据是从view中来的,请问能不能映射.

Alarm.hbm.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>
  <sql-query name="getAlarmList" callable="true" cacheable="false">
     <return alias="alarm_view" class="com.tnzi.fmo.alarm.domain.AlarmVo">
     <return-property name="alarmid" column="alarm_id"/>
     <return-property name="elementid" column="element_id" />
     <return-property name="ticketid" column="ticketid"/>
     <return-property name="alarmtime" column="alarm_time"/>
     <return-property name="alarmstatus" column="alarm_status"/>
     <return-property name="network" column="network_cd"/>
     <return-property name="collector" column="collector"/>
</return>

     {call I3.ALARM_PKG.getAlarmList(?, :networkCd, :elementId, :fromDate, :toDate, :pop, :ticketNumber) }
  </sql-query>
</hibernate-mapping>

///////////////////////////////////////////////////////////////////
sp:

PROCEDURE getAlarmList(
   p_alarm_list               OUT AlarmCsrTyp
  ,p_network                   IN  VARCHAR2
  ,p_element                   IN  VARCHAR2
  ,p_from                      IN  date
  ,p_to                        IN  date
  ,p_pop                       IN  VARCHAR2
  ,p_ticket_number             IN VARCHAR2
) -- wild card would be accepted.
IS
   PROC_NM CONSTANT              VARCHAR2(30) := 'getAlarmList';
   city_abrv                     VARCHAR2(64);
BEGIN
   city_abrv := SUBSTR(p_pop,1,2);
   OPEN p_alarm_list FOR
        SELECT alarm_id
              ,element_id
              ,ticket_id
              ,alarm_time
              ,alarm_status
              ,network_cd
              ,collector
          FROM alarm_view                    //////////////////此处是view
          WHERE (network_cd LIKE p_network||'%'
            OR network_cd = NVL(p_network,network_cd))
          AND (city LIKE city_abrv||'%'
            OR city = NVL(city_abrv,city))
          AND (ticket_id LIKE p_ticket_number||'%'
            OR p_ticket_number is null)
          AND (element_id LIKE p_element||'%'
            OR element_id = NVL(p_element,element_id))
          AND (alarm_time >= NVL(p_to,alarm_time))
          AND (alarm_time <= NVL(p_from,alarm_time));
EXCEPTION
   WHEN OTHERS THEN
        handleError(PROC_NM, SQLCODE, SQLERRM||'for network_cd <'||p_network||'>');
END getAlarmList;

//////////////////////////
view

CREATE OR REPLACE VIEW ALARM_VIEW
(alarm_id, element_id, ticket_id, alarm_time, alarm_status, network_cd, collector, city)
AS
SELECT  a.alarm_id
         ,a.element_id
         ,b.ticket_id
         ,a.alarm_time
         ,a.alarm_status_cd
         ,a.network_cd
         ,a.agent_collector_id
         ,a.source_element_id
         from alarm a
         left outer join alarm_ticket b
         on a.alarm_id = b.alarm_id
///////////////////////////////////////////////////
我发布的时候tomcat报错 rg.hibernate.MappingException: Unknown entity: com.tnzi.fmo.alarm.domain.AlarmVo

请各位大大指点..

你可能感兴趣的:(oracle存储过程)