DAO interface | Sololearn: Learn to code for FREE!

0

DAO interface

Im making program that stores the information of clients and employees (which inherit from person) so my question is if i should make one DAO interface for client and other for employee or i should do it like this: public interface PersonDAO { public int insert(Person person) throws SQLException; } and then cast to client/employee whenever i want to do anything?

1/18/2019 3:30:55 AM

Daniel

3 Answers

New Answer

+2

For readability, your interface should reflect how your tables are structured. If you have two tables (one table each), you should have two separate insert interfaces. If they are in one table, they can share an insert interface. I hope this helps!

+1

From the Java perspective not really, for the table performance it really depends on the access patterns. For most data which isn't too large, any performance difference should be negligible.

0

ok i have two tables so ill do two DAO interfaces, but is there a difference in performance between one or the other way?