You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use @DaTa annotations from lombok package for dynamic getters and setters , won't have to create getters and setters manually for all the parameters in entity classes.
Instead of prepared statements in DAO implementations , you could use JPA (Java persistence API) , it gives more flexibility in terms of querying the db.
It provides methods such as findById() where you won't have to write native sql queries explicitly.
Internally JPA uses prepared statements only , so it does the job of creating the corresponding queries for you.
good job on separating the DB Util class . [nit] => always close the conn object that you open.
conn object could have been globalized or passed as a reference .
In jpa , no need to create conn objects , it does the job for us . pasting some links for JPA
put Use cases classes in service layer where all the business logic must reside.
separate controller , service layer must be present .
could remove DBUtil from utility into configuration package and initialize the conn objects using dependency injection. Pasting some useful links for dependency injections below.
lombok package
for dynamic getters and setters , won't have to create getters and setters manually for all the parameters in entity classes.findById()
where you won't have to write native sql queries explicitly.- https://www.springboottutorial.com/spring-boot-projects-with-code-examples
The text was updated successfully, but these errors were encountered: