`
Godlikeme
  • 浏览: 165182 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

引文:java code vs database code

阅读更多
引自 Expert One-on-One J2EE Design and Development

FYI

The use of stored procedures from J2EE applications is an area where we should be pragmatic, and avoid rigid positions. I feel that many J2EE developers' blanket rejection of stored procedures is a mistake. There are clear benefits in using stored procedures to implement persistence logic in some situations:

Stored procedures can handle updates spanning multiple database tables. Such updates are problematic with O/R mapping.

A more general form of the first point) Stored procedures can be used to hide the details of the RDBMS schema from Java code. Often there's no reason that Java business objects should know the structure of the database.

Round trips between the J2EE server and the database are likely to be slow. Using stored procedures can consolidate them in the same way in which we strive to consolidate remote calls in distributed J2EE applications to avoid network and invocation protocol overhead.

Stored procedures allow use of efficient RDBMS constructs. In some cases, this will lead to significantly higher performance and reduce load on the RDBMS.

Many data management problems can be solved much more easily using a database language such as PL/SQL than by issuing database commands from Java. It's a case of choosing the right tool for the job. I wouldn't consider using Perl in preference to Java to build a large application; neither would I waste my time and my employer's money by writing a text manipulation utility in Java if I could write it in Perl with a fraction of the effort.

There may be an investment in existing stored procedures that can be leveraged.

Stored procedures are easy to call from Java code, so using them tends to reduce, rather than increase, the complexity of J2EE applications.

Very few enterprises with existing IT shops have ported all their applications to J2EE, or are soon likely to. Hence persistence logic may be more useful in the RDBMS than in the J2EE server, if it can be used by other non J2EE applications (for example, custom reporting applications or in-house VB clients).

The danger in using stored procedures is the temptation to use them to implement business logic. This has many negative consequences, for example:

There is no single architectural tier that implements the application's business logic. Updates to business rules may involve changing both Java and database code.

The application's portability will reduce as stored procedures grow in complexity.

Two separate teams (J2EE and DBA) will share responsibility for business logic, raising the possibility of communication problems.

If we distinguish between persistence logic and business logic, using stored procedures will not break our architecture. Using a stored procedure is a good choice if it meets the following criteria:

The task cannot be accomplished simply using SQL (without a stored procedure). There is a higher overhead in invoking a stored procedure using JDBC than in running ordinary SQL, as well as greater complexity in the database.

The stored procedure can be viewed as a database-specific implementation of a simple Java interface.

It is concerned with persistence logic and not business logic and does not contain business rules that change frequently.

It produces a performance benefit.

The code of the stored procedure is not unduly complex. If a stored procedure is appropriate, part of the payoff will be a simpler implementation than could have been achieved in a Java object running within the J2EE server. Especially in an organization with DBA resources, 10 lines of PL/SQL will prove easier to maintain than 100 lines of Java, as such a size discrepancy would prove that PL/SQL was the right tool for the job.

Important  Do not use stored procedures to implement business logic. This should be done in Java business objects. However, stored procedures are a legitimate choice to implement some of the functionality of a DAO. There is no reason to reject use of stored procedures on design grounds.

分享到:
评论

相关推荐

    网页设计:使用“引文”的网站设计技巧.docx

    例如,Campaign Monitor的引文:“针对设计师及其客户的电子邮件营销软件”可以使用户感到该服务是专门为设计师设计的。 5. 夸张手法 使用夸张的手法可以使用户感到网站的服务是非常出色的。例如,Dubbed Creative...

    网页设计:使用“引文”的网站设计技巧.pdf

    使用隐喻可以使用户更容易阅读网站的内容,例如Formee的引文:“为你网站定做的新鲜出炉的网页表单!我们为你烹饪了一份完全兼容web标准的表单,xHtml和CSS是独家秘方,尽情享用吧!”这个比喻可以使网站更加友好和...

    SSRN_ID3538962_code3495465.pdf.zip

    标题中的"SSRN_ID3538962_code3495465.pdf.zip"可能是指一篇在社会科学引文索引(SSRN)上发表的学术论文,其ID为3538962,代码为3495465。这种ID通常用于追踪和引用学术资源。描述中的"SSRN_ID3538962_code3495465....

    vscode-zotero-latex:VS Code扩展,为BibLaTeX添加Zotero引文

    这是用于将与扩展一起使用的VS Code扩展。 产品特点 该扩展程序的主要功能是从Zotero插入引文的命令。 在LaTeX文件中,使用Alt-Z并选择源。 引用将自动插入当前光标处。 这可以使用Zotero自己的UI或VS Code中的...

    vscode-zotero:VS Code的Zotero Better Bibtex引用

    VS代码引用选择器(适用于Zotero) 该软件包在VS Code Markdown编辑中增加了Zotero支持。 要使用它,您将需要在Zotero中安装Better BibTeX插件。特征如果您不想输入引文(坦白地说,您不必这么做),则执行“ Zotero...

    pix2code:pix2code:从图形用户界面截图生成代码

    pix2code 从图形用户界面截图生成代码 可以在系统的视频演示该论文可在官方研究页面: : 抽象将设计人员创建的图形...引文@article{beltramelli2017pix2code, title={pix2code: Generating Code from a Graphical Use

    标准化引文:标准过程参考文献

    标准化引用普遍适用的实用程序,适用于任何参考文件。 佩剑,佩剑,佩剑: Limparreferênciascitadas Enriquecê-lascom dados coletados em bases externas(CrossRef e bases ad hoc)安装说明docker build --tag...

    citeproc-java:Java的引用样式语言(CSL)处理器

    citeproc-java是Java的处理器。 它解释了CSL样式并生成了引文和书目。 文献资料 完整的文档可在项目的网站上找到: 有关使用过的组件的注意事项 citeproc-js 该库包括 ,这是一个用JavaScript编写的CSL处理器。 ...

    pyannote-db-voxceleb:用于pyannote.database的VoxCeleb插件

    用于pyannote.database的VoxCeleb插件 该软件包提供了VoxCeleb论文中使用的扬声器验证协议的实现。 引文 如果您的研究依赖于VoxCeleb数据集,请引用以下参考资料: @InProceedings { VoxCeleb , author = { ...

    文献引文分析利器 HistCite 详细使用教程

    首先,确保你的计算机上安装了Java运行环境,然后下载并解压HistCite的压缩包。运行程序,导入你的参考文献数据,通常以BibTeX或ISI格式存储。 三、数据导入与预处理 1. BibTeX导入:如果你的文献信息是以BibTeX...

    LaTeX自动化引文管理:从手动到智能的飞跃

    LaTeX是一种基于TeX的排版系统,广泛用于学术和科研领域的文档排版。它由美国计算机科学家Leslie Lamport在20世纪80年代初期开发,目的是提供一个高质量的文档排版工具,特别是用于生成包含复杂数学公式和科学符号的...

    Word入门动画教程:创建引文目录.docx

    Word 入门动画教程:创建引文目录 本文讲述了如何在 Word 中创建引文目录,引文目录是一种特殊的目录,主要用于法律类文档中创建参考内容列表,例如事例、法规和规章等。与索引不同,引文目录可以对标记内容进行...

    毕业设计-期刊引文数据挖掘系统.zip

    【标题】:“毕业设计-期刊引文数据挖掘系统”是一个基于数据挖掘技术的软件项目,主要目的是对学术期刊中的引文进行分析与研究。这个系统可能涵盖了数据收集、处理、存储以及可视化等多个方面,旨在帮助用户理解...

    soylent:从 code.google.compsoylent 自动导出

    code.google.com/p/soylent 自动导出作为将人类专业知识永久集成到我们的写作工具中的一步,我们推出了 Soylent,这是一个文字处理界面,它集成了人群贡献,以帮助用户完成复杂的写作任务,从错误预防和缩短段落到...

    信息计量学(九):第九讲 文献信息引证规律和引文分析法

    ### 信息计量学(九):第九讲 文献信息引证规律和引文分析法 #### 引文分析的概念和原理 ##### 引文分析的概念和意义 在科学研究的过程中,科学文献之间并非孤立存在,而是通过引用的方式形成复杂的网络结构。...

    Web上检索《科学引文索引》:SCI的使用与发展ppt-.pptx

    Web of Science(WOS)是一种强大的学术信息检索系统,它不仅涵盖了广泛的学术资源,还提供了独特的引文索引功能。该系统由汤姆森科技信息集团开发,旨在帮助科研人员高效地获取和分析科学信息。 ##### 引文索引...

    hiscite引文分析工具

    【标题】:Hiscite引文分析工具 【描述】:Hiscite是一款强大的引文分析工具,专门针对科学引文索引(Web of Science,简称WOS)数据库设计。它能够帮助研究者深入理解文献之间的引用关系,揭示学术领域的核心论文...

    LabelMeAnnotationTool:LabelMe批注工具的源代码-Source code

    引文: BC Russell,A。Torralba,KP Murphy,WT Freeman。 LabelMe:用于图像注释的基于数据库和基于Web的工具。 国际计算机视觉杂志,77(1-3):157-173,2008年。 下载: 您可以直接下载的。 另外,您可以按...

    信息检索与利用:如何利用科学引文索引(SCIE)助力科研.ppt

    《信息检索与利用:如何利用科学引文索引(SCIE)助力科研》 科学引文索引(Science Citation Index Expanded,简称SCIE)是由美国科学情报研究所(ISI)出版的一个重要的科研信息数据库,其内容涵盖自然科学、工程...

Global site tag (gtag.js) - Google Analytics