1. Annotation (refer to JPA specification, definition of annotation, acquisition of annotation) 2. Reflection (call method, get return value) 3. SQL generation (get the parameters [table, column] in the annotation, generate sql) 4. Obtain the return value through reflection, reflect it into the class, and assemble the parameters
Refer to this: http://www.oschina.net/code/s... There are only a few hundred lines of code. It’s just code under Android. To transplant it to ordinary JAVA, you need to make slight modifications.
Please refer to the source code of nutz.
http://study.163.com/course/c...
mybatis.
nutz contains too much.
1. Annotation (refer to JPA specification, definition of annotation, acquisition of annotation)
2. Reflection (call method, get return value)
3. SQL generation (get the parameters [table, column] in the annotation, generate sql)
4. Obtain the return value through reflection, reflect it into the class, and assemble the parameters
Refer to this: http://www.oschina.net/code/s... There are only a few hundred lines of code. It’s just code under Android. To transplant it to ordinary JAVA, you need to make slight modifications.
Openjpa