Answer the question
In order to leave comments, you need to log in
How to properly organize the application architecture?
Hello. Can you please suggest how best to design the application architecture.
I am writing a web application that will add to the database and read from it the information of users, as well as about their products.
I described all the entities
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "user_id")
private int userId;
@Basic
@Column(name = "name")
private String name;
...
public class UserDAO extends {
public User getUserByNumber(String number) throws UserNotFoundException;
public User getUserByEMAil(String eMail) throws UserNotFoundException;
...
public class UserService {
private UserDAO userDAO = new UserDAO();
public void createEntity(User user) throws CustomDAOException {
if (!isUserExists(user))
userDAO.create(user);
else System.out.println("User already exists");
}
...
Answer the question
In order to leave comments, you need to log in
I can offer the following hierarchy (package structure) in a simple version, it might look like this:
com.example.application:
it has the following layers:
accordingly, in resourse we take out the entire configuration (application contexts, configurations, properties) and also preferably everything by folders (frameworks that are used, for example, spring, hibernate, or the Java EE specification that decouples us, well, or tries to do this, from specific providers): )
I also advise you to google SOA / microservices
And also a useful article Learning to design based on the subject area ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question