Project Structure
Java
Every Java project in the organization is structured in the same way to ensure a uniform architecture
Schema level
At this level, all interface and data structures or dto are defined and inherited for the entire project.
Database level
In this level, the entities are defined, for a more profound programming it makes it possible to verify the input of the entities again if, for example, the length of the string fits or a time value is not negative. The exception is the time -1 indicates that the time is not set. Repositories are also created for the entities to provide easy access for the level above. Custom queries should be avoided, or created directly with the entity manager so that the db dialect overrides this to avoid direct sql code and minimize maintenance.
Logic Layer
Processes the data of the underlying layers. For a long time it was considered whether the data should be mapped via a dto. With a dto, the properties of lazy loading or direct references to the entites would be lost. Additional maintenance would also be required. This is also where the security part of the core takes place, for example. The filters, the account manager and the implementation of the permissions
Module Layer (optional)
This layer contains module information from the code. This is where all the important interfaces are tied together and packaged as a single package. This is a very useful method if the project is not just a service but a library.
Application Layer
Provides the service and also implements the api interfaces such as graphql or rest.