• iBatis,第二次亲密接触


    06年时候,曾经有段时间研究过iBatis和Hibernate,后来因为项目的关系,丢了好久了,最近又来兴趣了。

    ------
    iBatis和Hibernate各有用途

    iBatis是一个功能强大的,非常有用的SQL Map工具,不同于ORM工具(如hibernate),它是将SQL语句映射成Java对象,而对于ORM工具,它的SQL语句是根据映射定义生成的。
    iBatis和hibernate各有用途,如果你开始一个新的项目,对于领域对象模型和数据库设计拥有完全的控制权,hibernate是一个很好的ORM工具。
    但如果你要访问一个第三方数据库,或使用一个已有系统的数据库,或是一个设计很糟糕的数据库,ORM工具很难应付由此带来的复杂性。在这种情况下,iBatis就非常有用。
    还有,如果你的开发小组熟悉面向对象的开发模式并熟悉hibernate,你可以使用hibernate。而如果你的开发小组只熟悉SQL,并且不熟悉hibernate,建议你使用iBatis,毕竟使用iBatis要简单得多。只要熟悉SQL,会使用XML,即可使用iBatis,而使用hibernate,需要熟悉hibernate特有的查询语言HQL,虽然也比较简单。
    但iBatis目前还有着一个可能会严重影响性能的N+1查询问题没有解决,不过Clinton答应在iBatis2.0的正式发表前解决它,现在版本已经3.0了,我想应该已经解决了。

    ------
    有用链接:

    iBatis首页:http://ibatis.apache.org/,
    Abator(iBatis相关代码生成器,有Eclipse 插件):http://ibatis.apache.org/abator.html

    iBatis,第二次亲密接触

    ------

    Abator的Eclipse 插件安装(Automatic Eclipse Install)

    If you've already installed a prior version of Abator, simply run the Eclipse Install/Update tool and the new version will be found automatically.

    If you've not already installed Abator, then you can use the built in Eclipse install support by following these steps:

    1. Take the "Help>Software Updates>Find and Install" Menu Option
    2. Select the "Search for new features to install" radio button, press "Next"
    3. Press the "New Remote Site" button
    4. Enter the following information:
      Name:
      Abator for Eclipse Update Site
      URL:
      http://ibatis.apache.org/tools/abator
    5. Press OK
    6. Check the box next to "Abator for Eclipse Update Site"
    7. Follow the remainder of the install wizard

    ------

    安装好后将在New菜单中看到一个新的文件类型Abator for iBATIS Configuration File,此是Abator的配置文件,可根据自己的实际需求进行修改,配置文件的XML规范详细说明见 http://ibatis.apache.org/docs/tools/abator/
    XML文件修改完成以后,右键单击配置文件,点击Generate iBatis Artifacts,将生成iBATIS sqlMap XML文件和与数据表对应的实体类和DAO类的JAVA源程序,再根据自己的实际需求进行修改应用。

    如果开发一个大型系统,上百张表,几千个字段,手动写sqlMap XML文件,估计人都死了几遍了~

    ------

    工欲善其事,必先利其器,我一直这么认为!

  • 相关阅读:
    Hausdorff distance between mesh and its symmertic one.
    Fast algorithm to compute minimum volume oriented bounding box
    C++文件读写详解(ofstream,ifstream,fstream)
    libCURL开源库在VS2010环境下编译安装,配置详解
    VPB和OSGGIS安装
    OpenSceneGraph 笔记--如何导出三角形数据
    OpenGL编程指南(第七版)
    osgAnimation例子的注释的注释
    osg 示例程序解析之osgdelaunay
    VS2010+64+OSG3.2.1之五Plugins dae编译
  • 原文地址:https://www.cnblogs.com/longware/p/13382336.html
Copyright © 2020-2023  润新知