想自己试着写一个orm,使用注解和反射来实现,但是没有思路。在网上也没有找到类似的开源项目,有没有谁知道啊?
谢谢!
大家讲道理2017-04-18 09:44:36
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
PHP中文网2017-04-18 09:44:36
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.