andThe basic idea of the DAO pattern is that the code required to create, read, update, and delete (aka CRUD) an object from a data store is separated out from the object itself.
isn't it look similar to:Code: Select all
public Student getStudent(int id) // create an object public void createStudent(Student s) public void updateStudent(Student s) // update an object public void deleteStudent(int id)
Code: Select all
Connection c = DriverManager.getConnection("db url"); // => create an object
c.setAutoCommit(true); // => update the object
If yes, why it is a Factory pattern then?
If no, what's the difference?
Thanks in advance.