This paper researches on the mapping between object model and relation model, its purpose is to establish a persistence layer in Java develop environment, and encapsulating mapping information of object model and relation model out of the code. via this mode, it can obtain the following advantages: first, separates data access logic from business logic; second, reduces repeated code, so the developer can concentrate on the problems of business domain; third, enhances the maintainability and extensibility of application.This paper introduces the different techniques of object persistence, and their advantage and disadvantages in Java environment; then demonstrates the basic strategy of mapping object model to relation model, and analyzes the main problems of pure ORM; aiming to the deficiency of pure ORM, it proposes an overall design of a light-level ORM, and explains the function of each module briefly; and then poses the detailed design and implementation of critical component of each module, mainly includes: mapping generator, persistence manager, object operator, base of mapping information, organization of cache, the core logic of the system, and the strategy of performance optimization; then gives an example of how to use this system in J2EE, and tests the system according to its function and performance ; at the last of this paper, it summarizes the design and implementation of this system, and points out some parts which need to be research more in the future. |