【期刊论文】基于 J2EE的数据持久模型的设计与实现

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

223Vol.22No.320099JOURNALOFNINGBOUNIVERSITY(NSEE)Sept.2009:1001-5132200903-0364-06J2EE,,,,315211:,.,,,SQL,;,.:;;;:TP311:AIT,,.,,().,,.,,.1J2EE[1]1.1JavaJava,.,,:,,,I/O;;1,,“”,,..1.2JDBC,JDBC,,.JDBCJava,Java2008-12-25.::.E-mail:sunxia@nbu.edu.cn3,:J2EE365.,.,JDBC.1.3EJBBeanBeanEnterpriseJavaBean(EJB),,.Bean,,Bean.EJBBean,,Bean.BeanJDBC,,.,Bean,EntityBean,,.,.,,.,(JDBCEntityBean),.2DAO(DataAccessObject)[2-3]—–(DPM).DAO,,,DAO.DPM3,1.1,,,.,,,,.,.33.1[4-5](PersistenceObject),,.,PersistenceObject1,.,3:EntityRelationRendering,2,SwellBean.SwellBeanSwellJava-bean,3662009.Entity,().EntityJava,Java,1,load()store()2.Relation,.RelationEntity,Entity,Relation.Rendering,.,,Rendering.,,DPMBeanEJBBean,Bean,.,Bean;,Bean,Bean.EJBBeanstore,load.,1,,store,.DPMEntity,,Bean,Entity,,.,StudentEntity,StudentEntity,,1Student1Entity.001”:Studentstudent=newStudent();student.setStudentid(“001”);student.manangerByPersistenceMananager(pm);student.load();Entityload:publicbooleanload()throwsCommonException{checkManager(“load()#1”);return_persistenceManager.loadEntity(this);//,loadEntity(),Entity.}3.2(PersistenceManager)[6],,PersistenceOjbect,PersistenceManager,.,EntityRelationRederingload()store(),PersistenceManager233,:J2EE367,PersistenceManager,Entity,SQL,,PersistenceManager.,PersistenceManagerAPI,API,3.3EntityMeteData,entityProfileManager,SQLParser,SQL,EntitySQL.Accessor,.3:SqlPersistenceManager//,_profileManager=profileManager;//_connection=dataSource.getConnection();//_accessor=newAccessor(_connection);//SQLSQLParserparser=getSQLParser();//SQLstate=newSQLState();//state.setName(name);//SQLstate.setSql(parser.forLoad(profile));publicbooleanqueryEntity(Entityentity,SQLStatestate)throwsCommonException{………..setStatement(state.getSql());//SQL…………accessor.executeQuery();//accessor.first();//accessor.get(this);aceessor.close();//}3.33.3.1[7],SQLOperation,1,,SQLOperation,,SQL-Operation.,,SQLOperation,4.4SQLOperation36820093.3.2[8],SQLOperationPersistenceManager,,,Accessor,,SQLOperation.SQLOperation,Accessor,5.SQLOperation,Accessor,Accessor,,1XML,XMLSQLOperation,Accessor.5SQLOperation,SQLOperationSQLOperation.EntityAccessor,SQLOperationFactory1SQLOpera-tion,SQLOperationFactorySQLOperation1SQLOperation,SQLOperation,SQLOperationFactory1SQLOperation,SQLOperationFactorySQLOperation.SQLOperationFactorySQLOperation,SQLOperation,SQLOperationFactorySQLOperation,,:ClassSQLOperationFactory{publicSQLOperationgetOperation(Stringsql)throwsException{if(sql)returnnewSQLQuery();elseif(sql)returnnewSQLUpdate();………..elseif(sqlXML)returnnewSQLXML();elsethrownewException(“”);}},PersistenceManager:(1)SQLOperation:;(2):SQL-Operation,SQLOperation;(3)SQL-OperationFactory:SQLOperation,SQLOperation.4,.J2EE,,.,,.,3,:J2EE369,,,,.,,SQLOperator,,.:[1],,.Java[J].,2005,26(2):255-267.[2]CliftonNock.:[M].,.:,2004.[3]ErichGamma,RichardHelm,RalphJohson,etal.Designpatterns:Elementsofreusableobject-orientedsoftware[J].NewYork:AddisonWesley,1995.[4],,.——Java[J].,2005,22(11):28-30.[5],.[J].,2005,32(5):95-97.[6]ScottWA.Thedesignofarobustpersistencelayerforrelationaldatabases[EB/OL].[2000-11-07].[7]PatrickChan.Javadevelopersalmanac1.4volume1examplesandquickreference[M].NewYork:PearsonEducationInc,2002.[8]JushuaBloch.EffectiveJavaprogramminglanguageguicle[M].NewYork:PearsonEducationInc,2003.DesignandImplementationofDataPersistenceLayerModelBasedonJ2EESUNXia,HUXu-chang,YAOChang,HUORui(CollegeofScienceandTechnology,NingboUniversity,Ningbo315211,China)Abstract:Aimingatdevelopingobject-orientedtechnologyandrelationaldatabaseinageneralenvironmentforenterpriseapplications,thisarticlestudiestheapproachesfordatapersistencesolutionandmodelconstruction.ProxymodelisusedtomanagedatapersistencebasedonO/RMapping.Theencapsulatedunderlyingdataaremadecompletelyaccessible,withtheobjectmodelandrelationaldatabasebeingindependentofeachotherbybuildingSQLcodedynamicallywiththequeryofoperationandmappinginformation.Thedataaccessingefficiencyisgreatlyupliftedthroughthedynamicallocationandthebufferingmechanism.Keywords:object-oriented;relationaldatabase;mapping;datapersistenceCLCnumber:TP311Documentcode:A

1 / 6
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功