資源描述:
《hibernate+spring徹底搞定clob、blob的存取》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、Hibernate+Spring徹底搞定Clob、Blob的存取摘要:本文通過一個(gè)實(shí)例講述如何通過Spring2+Hibernate3來快捷操作數(shù)據(jù)庫(kù)中的Lob字段。環(huán)境:Oracle10g、Srping2、Hibernate3、JUint4說明:由于時(shí)間緊迫,沒有詳細(xì)寫出思路。運(yùn)行一下例子就明白了。一、創(chuàng)建實(shí)體并添加Xdoclet的Hibernate標(biāo)簽/***@authorleizhimin*@hibernate.mappingdefault-lazy="false"*@hibernate.metaattribut
2、e="class-description"value="工作日志"*@hibernate.classtable="rc_gzrz"*/publicclassWorkNote{privateLongid;//標(biāo)識(shí)privateDateworkDate;//日期privateStringweather;//天氣privateStringcontent;//日志內(nèi)容(Clob)privateStringstate;//日志狀態(tài)privateLongorgId;//機(jī)構(gòu)idprivateLonguserId;//用戶idpri
3、vateDatecreateDate;//創(chuàng)建日期privatebyte[]image;//圖片publicstaticfinalStringWORKNOTE_BLANK="00";//未填寫publicstaticfinalStringWORKNOTE_FULL="11";//已填寫/***@hibernate.idgenerator-class="sequence"column="BS"*@hibernate.metaattribute="field-description"value="標(biāo)識(shí)"*@hibernat
4、e.generator-paramname="sequence"value="SEQ_GW"*/publicLonggetId(){returnid;}publicvoidsetId(Longid){this.id=id;}/***@hibernate.propertycolumn="workDate"not-null="false"type="timestamp"*@hibernate.metaattribute="field-description"value="工作日期"*/publicDategetWorkDa
5、te(){returnworkDate;}publicvoidsetWorkDate(DateworkDate){this.workDate=workDate;}/***@hibernate.propertycolumn="weather"not-null="false"length="24"*@hibernate.metaattribute="field-description"value="天氣"*/publicStringgetWeather(){returnweather;}publicvoidsetWeath
6、er(Stringweather){this.weather=weather;}/***@hibernate.propertycolumn="content"not-null="false"type="text"*@hibernate.metaattribute="field-description"value="內(nèi)容"*/publicStringgetContent(){returncontent;}publicvoidsetContent(Stringcontent){this.content=content;}/
7、***@hibernate.propertycolumn="state"not-null="false"length="2"*@hibernate.metaattribute="field-description"value="狀態(tài)"*/publicStringgetState(){returnstate;}publicvoidsetState(Stringstate){this.state=state;}/***@hibernate.propertycolumn="orgId"type="long"*@hiberna
8、te.metaattribute="field-description"value="機(jī)構(gòu)id"*/publicLonggetOrgId(){returnorgId;}publicvoidsetOrgId(LongorgId){this.orgId=orgId;}/***@hibernate.propertycolumn="use