posts - 28,  comments - 13,  trackbacks - 0
Hibernate 原生SQL
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
>
<!-- Generated 2007-3-20 16:44:34 by Hibernate Tools 3.2.0.beta8 -->
<hibernate-mapping>
    
<class name="com.mip.biz.defect.domain.TypidefdetailVo">
        
<id name="oid" type="java.lang.Long">
            
<column name="OID" precision="22" scale="0" />
            
<generator class="assigned" />
        
</id>
        
<property name="devtype" type="string">
            
<column name="DEVTYPE" length="20" />
        
</property>
        
<property name="pwlevel" type="string">
            
<column name="PWLEVEL" length="20" />
        
</property>
        
<property name="stno" type="java.lang.Long">
            
<column name="STNO" precision="22" scale="0" />
        
</property>
        
<property name="stname" type="string">
            
<column name="STNAME" length="50" />
        
</property>
        
<property name="factory" type="string">
            
<column name="FACTORY" length="40" />
        
</property>
    
        
<property name="devstyle" type="string">
            
<column name="DEVSTYLE" length="40" />
        
</property>
        
<property name="finddate" type="java.util.Date">
            
<column name="FINDDATE" length="7" />
        
</property>
        
<property name="definfo" type="string">
            
<column name="DEFINFO" length="200" />
        
</property>
        
<property name="defreason" type="string">
            
<column name="DEFREASON" length="200" />
        
</property>
        
<property name="measure" type="string">
            
<column name="MEASURE" length="200" />
        
</property>
        
<property name="cleardate" type="java.util.Date">
            
<column name="CLEARDATE" length="7" />
        
</property>
      
    
</class>
    
<!-- 典型设备缺陷报表(紧急+重大+一般,详细情况) -->
<sql-query name="queryTypidefdetailReportQuerySql">
    
<return alias="detail" class="com.mip.biz.defect.domain.TypidefdetailVo">
        
<return-property name="oid" column="typOID"/>
        
<return-property name="devtype" column="typDEVTYPE"/>
        
<return-property name="pwlevel" column="typPWLEVEL"/>
        
<return-property name="factory" column="typFACTORY"/>
        
<return-property name="devstyle" column="typDEVSTYLE"/>
        
<return-property name="finddate" column="typFINDDATE"/>
        
<return-property name="definfo" column="typDEFINFO"/>
        
<return-property name="defreason" column="typDEFREASON"/>                                
        
<return-property name="cleardate" column="typCLEARDATE"/>                                
        
<return-property name="measure" column="typMEASURE"/>
        
        
<return-property name="stno" column="typSTNO"/>                                                        
        
<return-property name="stname" column="typeSTNAME"/>        
                
    
</return>
    
<![CDATA[
    SELECT 
        1 as typSTNO,
        'stname' as typeSTNAME,
        definfo.taskbillid AS typOID,
        definfo.devtype AS typDEVTYPE,
        definfo.powerlevel AS typPWLEVEL,
        definfo.devfactory AS typFACTORY,
        definfo.xinghao AS typDEVSTYLE,
        definfo.findtime AS typFINDDATE,
        definfo.findcontent AS typDEFINFO,
        definfo.slidea AS typDEFREASON,
        definfo.checktime AS typCLEARDATE,
        definfo.checkresult AS typMEASURE
     FROM DEFECT_DEFECTINFO definfo 
     WHERE 
        definfo.orgid = :orgid
    
]]>
</sql-query>     
</hibernate-mapping>
对应的java代码
    public List queryTypidefdetailsByHibernate(Long loginerOrgid,Date startTime, Date endTime) {
        Query query 
= this.getSession().getNamedQuery("queryTypidefdetailReportQuerySql");
        query.setLong(
"orgid"new Long(1));
        List result 
= query.list();
        
return result;
    }
posted on 2007-03-29 13:20 Lib 阅读(2022) 评论(0)  编辑  收藏 所属分类: 开源框架

只有注册用户登录后才能发表评论。


网站导航:
 
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567



我的JavaEye博客
http://lib.javaeye.com


常用链接

留言簿(2)

随笔分类

文章分类

FLASH

Java

搜索

  •  

最新评论

阅读排行榜

评论排行榜