Hibernate中sql-query return CDATA 用法

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping 
          PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" 
          "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.boomlink.web.model">
	
	<class name="com.boomlink.web.model.UserReport" table="T_USER_REPORT">
		
		<id column="ID" name="id" unsaved-value="0">
			<generator class="increment" />
		</id>
		<property column="USERID" name="userid" />
		<property column="REPORT" name="report" />
	</class>
	
	
	<sql-query name="SelectReportByUserId"> 
	    <return alias="t" class="com.boomlink.web.model.UserReport"></return>
		<![CDATA[ 
                 SELECT
                 um.ID AS {t.id},
                 um.USERID AS {t.userid},
                 um.REPORT AS {t.report}
                 FROM
                 T_USER_REPORT um
                 WHERE
                 um.USERID=?
                 ORDER BY um.ID
    ]]>
  </sql-query>
  

  <sql-query name="DeleteReportByUserId">
		<return alias="t" class="com.boomlink.web.model.UserReport"></return>
		<![CDATA[ 
                 DELETE
                 FROM
                 T_USER_REPORT
                 WHERE
                 USERID=?
    ]]>
  </sql-query>
</hibernate-mapping>  



你可能感兴趣的:(Hibernate)