Font Size: a A A

Design And Implementation Of A Lightweight Persistence Framework Based On Java Reflection

Posted on:2008-12-06Degree:MasterType:Thesis
Country:ChinaCandidate:X H ZhangFull Text:PDF
GTID:2178360245993101Subject:Computer software and theory
Abstract/Summary:PDF Full Text Request
At present, the relational database is still the most widely used way to store persistent data. In Java, there are a number of technologies can be used to access relational databases, which can be divided into two major categories: SQL-based technologies that works with relational concepts; and technologies based on O/R mapping. Although JDBC is the standard and most powerful API for accessing relational databases, it is only a low-level call-level interface that is relatively cumbersome to use correctly. Tools like iBATIS Data Mapper are thin wrappers above JDBC. They hide many details of the use of JDBC for us while retaining the full power of SQL. Nevertheless, they are still at the lower-level: we have to maintain SQL statements which widely spread in codes or XML documents. O/R mapping tools such as Hibernate and some JDO implementations provide us with transparent persistence, we can concentrate on our business logics and ignore the existence of JDBC even RDBMS when using such tools. Unfortunately, O/R mapping tools are always too complex and difficult to master.For applications that need to be developed rapidly, we need a simple solution, which should be flexible and useable. This paper presents a pattern named Reflective DAO which is a special case of the Data Access Object pattern. By applying Reflective DAO, customizing reusable and maintainable persistence layer can be very easy. Further more, this paper designs and implements a lightweight java persistence framework named refldao. The refldao framework is completely constructed on the Java SE standard libraries (JDBC API, Reflection API and so on), thus there is no more reliance when using it. The Reflective DAO is the underlying pattern of refldao, the application of reflection makes it possible to get DAO instances and the automatic CRUD capacity against POJO without inheriting any super class. In addition, refldao uses a lot of Java 5.0 new features (e.g., Annotation, Generic, Vararg) in order to simplify the operation of data access significantly.
Keywords/Search Tags:Object Persistence, Design Patterns, Framework, Reflection
PDF Full Text Request
Related items