I have a DAO with many methods, each containing an SQL statement to execute. I don’t want to hard code SQL strings into the DAO Java class so what’s the best way of managing this scenario? I am thinking of injecting them, but how best to do this?
Cheers,
Matt
You can inject your SQL statements during application initialization.
Then you can have your SQL statments in XML file, not hardcoded.
You can even externalize your SQL statements to
.propertiesfiles.Take a look: http://www.summa-tech.com/blog/2009/04/20/6-tips-for-managing-property-files-with-spring/