Based springJDBC handwriting ORM framework

A, package dependency added MySQLjar

 

 Second, the structure

 

 Third, the contents of the file

(A), bean package

1、ColumnInfo.java

 

 

 

2, javaFiledInfo.java

 

 

 

 

 

3 TableInfo.java

 

 

 

 4, Configration.java for profile attribute mapping properities

 

 

(B), the configuration file

 

1, properties profile

 

 

 

 

 

(C), util Package

 

 

 1、

 

 2、

 

 3、

 

 4, the use of reflection getClass get the current passed to the Class object class, because each file is compiled java is a good example of the Class, it is natural that such information can in turn be obtained by acquiring Class object. The method parameter name parameter for the second process example of a method getMethod Class methods such publicly available inside the first parameter for the class disclosed. Finally invoke method returns the Method instance, the first parameter is the type of the parameter, the second argument is that the disclosed method just to find the parameters of that method of execution is actually just acquired and then returns that method's return value.

 

 5、

 

 6、

 

 

 

 

 

 

 

 

 

 

 

 (Four), core package

1、

 

 

2、

 

 

 

 

3、

 

 

4、

 

 

5、

 

 

6、

 

 

The following DatabaseMetaData Connection object class is a property may be used to check some of the information in the database as a whole version number, url, etc., may be referred to as metadata, can be acquired by the table name field name and the like to obtain this information, to generate the entity classes do ready.

 

 

 

 

 

 

 

The following line 70 is passed in the use of a type of the field name is obtained, in fact, an entity class get method a field in a field corresponding to the parameters, and obtaining the value of the field get invoked method through reflection, value is not empty then added to the collection to go.

 

 Finally, first generate entity classes may then perform crud, a method for increasing the execution here.

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/prajna-zhou/p/zhoup.html