---
title: "ORM实现持久化过程"
author: "ork"
date: "2011-06-29T17:21:46Z"
tags: []
categories: ["企业架构"]
slug: "orm"
draft: false
lastmod: "2011-06-29T17:25:28Z"
id: 1109591
url: "https://ork.iteye.com/blog/1109591"
---

以session.save(customer)为例了解ORM实现持久化的过程，具体步骤如下：

1. 语句执行后，ORM中间件运用Java反射机制，获得customer对象的类型CustomerBean.class
2. ORM中间件参照对象-关系映射文件，获得对应信息。如CustomerBean和表customer对应的消息。
3. 根据映射信息生成SQL语句。
4. 执行SQL语句，完成持久化。