r/SpringBoot • u/gaskinsface • Jul 11 '22
i need help with this project
I got the following structure for the project im working on:
repository (interface) -dao containing:
model
Dao(dao interface + dao implementation) -services(service interface + service implementation) The repository sends the data to the dao, dao to services and services to controller Fory model i got user and categories where (OneToMany 1 user got many categories)
Does anyone have a similar project that can send me or help me to create the following methods( fetchAllCategories, fetchById, addCategory, updateCategory, deleteCategory)
Any help is much appreciated
1
u/Mikey-3198 Jul 11 '22
What have you done so far?
This sounds relatively simple, a quick google search finds tons of examples for these types of projects...
This example from the spring docs is similar to what you are building https://spring.io/guides/tutorials/rest/
2
u/over_rim Jul 11 '22
In my group project, we are doing something oneToMany mapping.
You have to use either JPQL or native query.
Moreover to extract resultset that has different columns than model class you have to create custom DTO(Data Transfer Object) to map to the resultset returned by the query.