Announcement Announcement Module
Collapse
No announcement yet.
daoFactory design issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • daoFactory design issue

    Hi Guys,

    I'm using Spting 2.5 along with ZK for Presentation layer. I have got a lot of DAOs, 44 to be precise to deal with.

    My question is whether to use the daofactory patter as more or less all the Spring developers use or to go with a utility class called SpringUtil provided by ZK. ZK integrates with Spring and provides this class.

    You can get any bean from this class in this form

    One more question, are 44 daos(may increase later) large enough in number for me to refrain from using a separate daoFactory and use the below mentioned method?

    SpringUtil.getBean("beanName");

    So, basically it is a design issue that I must deal with.

    Thanks!!!

  • #2
    I wonder why you need to use getBean at all.?. ideally wouldn't you just inject the dao into the class/bean requiring it's use (e.g. the service class).

    Or maybe you have some special requirement. Sometimes if the class in which you need to utilize the dao can not be a spring bean, then that is one thing. But if it is a stateless singleton, then can you just inject the dao there and you don't ever have to call getBean? Even if you have state, you can use a prototype bean and inject it.. but then of course you'll prob have to use getBean on the prototype bean in the code so that new beans are created each time, but hopefully you're dealing with a singleton that won't have this issue.?.

    OR.. maybe i'm missing the plot and having that many dao's makes it hard to inject them all so you're dynamically loading them or something? I've never worked on a project with that many so haven't hit that perhaps

    Comment

    Working...
    X