java-design-patterns
java-design-patterns copied to clipboard
Unit of Work pattern is Too simplified
unit-of-work/src/main/java/com/iluwatar/unitofwork/StudentDatabase.java
how can u save a complex object graph with a simple modify
call?
should modify
update everything in object graph?
public class StudentDatabase {
public void insert(Student student) {
//Some insert logic to DB
}
public void modify(Student student) {
//Some modify logic to DB
}
public void delete(Student student) {
//Some delete logic to DB
}
}
It.s seems better to add a final prefix before String delete, modify, insert。
public interface IUnitOfWork<T> { String INSERT = "INSERT"; String DELETE = "DELETE"; String MODIFY = "MODIFY";
It.s seems better to add a final prefix before String delete, modify, insert。
public interface IUnitOfWork<T> { String INSERT = "INSERT"; String DELETE = "DELETE"; String MODIFY = "MODIFY";
@cloudeswift variables of interface are final static by default. This PR is not required https://stackoverflow.com/questions/2430756/why-are-interface-variables-static-and-final-by-default