AUTOMATIC CODE GENERATION FOR ORM-SYSTEM ACTIVEJDBC BASED ON ANNOTATION PROCESSING TECHNOLOGY

Authors

DOI:

https://doi.org/10.32782/IT/2024-2-12

Keywords:

ActiveJDBC, ORM, code generation, Java, Dynamic Proxy, Annotation Processor, database manipulation strategies

Abstract

The promising development of the software development field has led to the emergence of various templates and strategies for manipulating databases and, accordingly, the tools that implement them. One of the design patterns that is gaining more and more popularity is Active Record. This template allows encapsulating all the logic of working with the database table in the model class itself, which eliminates the need to create additional service classes that will be responsible for CRUD operations. One of the implementations of this approach is the ActiveJDBC ORM system. ActiveJDBC is developed as open source software and is a popular choice for developing Java applications that interact with relational databases. The aim of the work is to present the process of improving the user experience when working with the ActiveJDBC ORM system. The improvement is achieved through automatic code generation, which allows manipulating ActiveJDBC objects as POJOs. The methodology for solving the task consists in the development of an annotation processor, which allows automatically code generating at the compilation stage that will interact with the ORM objects of the ActiveJDBC system. The scientific novelty of the obtained results lies in the fact that for the first time software was developed that facilitates interaction with ActiveJDBC components and allows adding functionality that was not included in ActiveJDBC by its developer. Conclusions. Approaches to the generation of program code in the Java programming language have been studied, and an annotation handler has been developed, which allows automatically at the compilation stage to generate code that will interact with ORM objects of the ActiveJDBC system. The developed tool allows: to free the programmer’s working time from writing template code, and to focus on solving the tasks, and not on maintaining the database interaction tool; reduce the amount of code that must undergo validation during the Code Review process; increase the readability of the received code, thanks to the use of getters and setters, the names of which correspond to the JavaBeans specification, and the use of the Builder pattern.

References

ActiveJDBC. URL: https://javalite.io/activejdbc (дата звернення: 28.10.2023).

JavaBeans(TM) Specification 1.01 Final Release. URL: https://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/ (дата звернення: 28.10.2023).

Spring dominates the Java ecosystem with 60% using it for their main applications. URL: https://snyk.io/blog/spring-dominates-the-java-ecosystem- with-60-using-it-for-their-main-applications/ (дата звернення: 28.10.2023).

All About Annotations and Annotation Processors. URL: https://medium.com/swlh/all-about-annotationsand-annotation-processors-4af47159f29d (дата звернення: 28.10.2023).

Downloads

Published

2024-07-31