将MySQL视图映射到hibernate时,表缺少错误

时间:2014-04-04 12:23:41

标签: java mysql hibernate mapping

我正在尝试将MySql视图映射到hibernate。但是当我在启动应用程序时得到并且表缺少错误时。

视图是

CREATE 
ALGORITHM = UNDEFINED 
DEFINER = `mydbadmin`@`%` 
SQL SECURITY DEFINER
VIEW `Reservation_Transaction_view` AS
select 
    convert( concat(`apst`.`Tid`,
            _utf8'-',
            `apst`.`RoomIndex`,
            _utf8'-',
            `apst`.`Rid`) using utf8) AS `id`,
    `apst`.`Tid` AS `transactionId`,
    `apst`.`RoomIndex` AS `room no`,
    `apst`.`Pid` AS `paymentId`,
    `apst`.`Rid` AS `reservationId`
from
    `agent_payment_sub_transaction` `apst`
where
    (`apst`.`Rid` <> 0)
group by `apst`.`Tid` , `apst`.`RoomIndex`

映射

<?xml version="1.0"?>
<hibernate-mapping>
<class name="com.abc.def.entity.ReservationTransactionView"
    table="Reservation_Transaction_view" catalog="abcd">
<id name="id" type="string" />
<property name="transactionId" type="java.lang.Integer">
    <column name="transactionId" />
</property>
<property name="roomNo" type="java.lang.Integer">
    <column name="`room no`" />
</property>
<property name="paymentId" type="java.lang.Integer">
    <column name="paymentId" />
</property>
<property name="reservationId" type="java.lang.Integer">
    <column name="reservationId" />
</property>

   

错误如下。

org.hibernate.HibernateException: Missing table: Reservation_Transaction_view

我正在使用MySQL和Hibernate3.0请帮我查询。

提前致谢。

0 个答案:

没有答案