I'm trying my hand at using the DAO pattern but I doubt if I'm using it as it is meant. For the time being I'm calling the JDBC implementation (which is all that I'm going to need at this point).
Is retrieving the data in the main method for serious use case a good thing? I was reading old posts and a bottom post showed using the DAO with the help of dependency injection? I've never used dependency injection and would like to know how it would come in handy here.
Do let me know your thoughts and how could I improve my code.
Here is the code getting the data from the persistent store,
posted 3 years ago
Dependency injection would remove the dependency between your client class and the JdbcCustomerInfoDao class. So all the client knows would be CustomerInfoDao which would typically be an interface.
Dependency injection however requires some libraries that implement it to be available in your client environment. Popular ones are CDI , Spring and Google's Guice.