`

Some puzzles

阅读更多
记录一些在IBatis中不是很舒服的地方:(随时保持更新)

1. 在映射文件中配置了select, update, insert, delete等语句的id,由我们在配置文件中指定。但是,我们在dao方法中的相关方法要记住这些id,如果引用不正确的话会发生错误。

2. N+1查询问题,Product 和 Category 是 N V 1的关系,如果
<result property=”category” column=”PRD_CAT_ID” select=”getCategory”/>

如上诉代码所示,取得一个product所属的Category时,需要再执行另一条SQL语句。那么,取得同一个分类下的多个产品,那么肯定是至少执行N+N次SQL语句的。为什么是说N+1次呢?已经考虑了Cache SQL语句么?比较疑惑。

而避免这个问题,就是将两次查询变成一次查询,也就是使用联合查询就OK了。

3. 延迟加载和联合查询的取舍问题。如果说应用中不会一下子就要将Product所属的分类显示出来,那么或许我们可以考虑延迟加载的方式。其含义就是只有实际用到product的Category信息的时候,我们才去数据库中将这个product的信息取出来。代码比较简单。

ok,应该都不是太大问题。另外一点,看的文档是2004年的版本,不知道和现在的IBatis版本差别多少,这是个问题。总之,在没有实际应用之前,不要太乐观,谨慎小心,做好记录,以便找到回来的路。

todo:写一个应用,将IBatis用上去看看。






分享到:
评论

相关推荐

    2020春五年级英语下册Module5模块知识梳理外研版三起

    - 例句:Some puzzles are easy, but others are quite hard. #### 8. **can (否定形式) can’t** - 例句:I can play the piano, but I can’t play the violin. #### 9. **she (宾格) her** - 例句:She gave ...

    First Course in Algorithms Through Puzzles

    Some famous real puzzles are also used to describe the algorithms. These puzzles are quite suitable for explaining the basic techniques of algorithms, which show how to solve these

    Exceptional C++ 47 Engineering Puzzles, Programming Problems, and Solutions

    Then take a few minutes and challenge yourself with some tough C++ design and programming problems. The puzzles and problems in Exceptional C++ not only entertain, they will help you hone your ...

    lets-make-some-puzzles

    让我们做些困惑跑步yarn installyarn start用于添加新的拼图前往src / routes /。 创建一个文件夹,然后在其中添加文件。 转到src / App.svelte并导入您的组件并添加到路线重要说明:使用纱线不是NPM PS:在App....

    Addison.Wesley.Exceptional.C++.Style.40.New.Engineering.Puzzles,.Programming.Problems.and.Solutio.chm

    The puzzles will show how to reason about C++ design and programming issues some of them common issues, some not so common; some of them plain issues, some more esoteric; and a couple because, well, ...

    ExceptionalCpp_47EngineeringPuzzlesProgrammingProblemsSol.chm

    Then take a few minutes and challenge yourself with some tough C++ design and programming problems. The puzzles and problems in Exceptional C++ not only entertain, they will help you hone your ...

    Sudoku.Programming.with.C.1484209966

    The C code is significant and so it is best to have some prior knowledge of C. Table of Contents Chapter 1. Modelling a Sudoku Puzzle in C Chapter 2. The Strategies Chapter 3. Main Program and ...

    Mission Python (2018.10出版,EPUB格式)

    Before you know it, you'll have a working, awesome game to stump your friends with (and some nifty coding skills, too!). You can follow this book using a Raspberry Pi or a Microsoft Windows PC, and ...

    3D.Printing.Designs.The.Sun.Puzzle.1785888897

    Jigsaw puzzles derive their name from when they were cut from wood sheets using a hand-woodworking tool called a jig saw back in the 1760s. Have you ever wondered how a model idea for a jigsaw puzzle ...

    Head First Python

    Learn quickly and have some fun at the same time with Head First Python. This book takes you beyond typical how-to manuals with engaging images, puzzles, stories, and quizzes that are proven to ...

    more exception C++ en

    Do you enjoy solving thorny C++ problems and puzzles? Do you relish writing robust and extensible code? Then take a few minutes and challenge yourself with some tough C++ design and programming ...

    Exceptional C++

    计算机经典著作 Exceptional C++ shows by example how to go about sound software engineering in ... Then take a few minutes and challenge yourself with some tough C++ design and programming problems.

    《怪曲线、数兔子及其他数学探究》的外文版本

    Drawing on areas of mathematics from probability theory, number theory, and geometry, he explores a wide range of concepts, some more light-hearted, others central to the development of the field and...

    Multi-digit Number Recognition from Street View Imagery using DCNN

    Recognizing arbitrary multi-character text in unconstrained natural photographs is a hard problem. In this paper, we address an equally hard sub-...and in some cases exceeds, that of human operators.

Global site tag (gtag.js) - Google Analytics