作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2007, Vol. 33 ›› Issue (22): 54-56,5. doi: 10.3969/j.issn.1000-3428.2007.22.019

• 软件技术与数据库 • 上一篇    下一篇

一个基于类型元数据的轻量级ORM框架设计

黄 强1,2,张晓梅3,冉 鸣1,楼新远3   

  1. (1. 四川师范大学计算机软件实验室,成都 610041;2. 四川农业大学信息工程学院,雅安 625000;3. 西南交通大学信息网络中心,成都 610031)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2007-11-20 发布日期:2007-11-20

Design of Lightweight ORM Framework Based on Class Metadata

HUANG Qiang1,2, ZHANG Xiao-mei3, RAN Ming1, LOU Xin-yuan3   

  1. (1. Computer Software Laboratory, Sichuan Normal University, Chengdu 610041; 2. School of Information Science and Engineering, Sichuan Agricultural University, Yaan 625000; 3. Information and Net Center, Southwest Jiaotong University, Chengdu 610031)
  • Received:1900-01-01 Revised:1900-01-01 Online:2007-11-20 Published:2007-11-20

摘要: 关系对象映射框架为消除对象和关系数据库之间的阻抗提供了有效的解决方案,目前虽有很多优秀的ORM框架已得到广泛的应用,但ORM的一些固有缺陷,如繁琐的配置文件和关联域模型、过度复杂的持久层API和性能低下的缓存结构,对项目开发产生了一定的负面影响,也增加了学习成本。该文针对ORM的上述缺陷,设计并实现了基于类型元数据的轻量级ORM框架Speed,它使用约定规则和类型元数据反射技术完全消除了ORM映射文件,采用简单高效的对象标识缓存和查询缓存,有效地提高了系统性能,并结合实际系统阐述了如何使用Speed的简单API实现ORM的快速开发。

关键词: 对象关系映射, 类型元数据, 反射, 缓存, 约定规则

Abstract: RM framework provides an effective way to eliminate the resistance between object and relative database. Nowadays, although lots of excellent ORM frameworks are widely applied to enterprise projects, some intrinsic defects of ORM, such as fussy configuration files and relative domain models, over complicated persistence APIs and inefficient cache structures, brought some negative effects to project development as well as increase costs of study. In order to solve them, a class metadata based lightweight ORM framework called Speed is proposed, ORM mapping files can be completely dispelled with convention rules and class metadata reflection technology. By using simple and efficient object identifier caches and query caches, speed improves the system performance in effect. Fast system development by using compact Speed APIs is expatiated with combination of actual system.

Key words: object-relative mapping(ORM), class metadata, reflection, cache, convention rule

中图分类号: