• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DAO pattern

 
Ranch Hand
Posts: 75
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I've been reading posts of people who as failed on the assignment and some of them received this comment : "Missing DAO/integration classes".
Well. I communicate with 3 external systems:

1 - E-mail server. I have a DAO for it.
2 - WebService. I created a package with a Interface and a JAXB class in it and I made a note that the package represents the classes of a webservice client generated by wsimport tool. I injected the interface (@WebserviceClient) directly into my business EJB by a @WebServiceRef annotation.
3 - JMS: I receive messages from another system and I have a MDB that takes the message, unmarshal it and sends to my business EJB.

My question: For the cases number 2 and 3 I have classes that act as DAO but aren't named as so.

I woudn't do it in real life, but for the case of exam, do I have to create additional DAOs for the cases 2 and 3? I think it's strange, but as some people have failed for it, I think it's wise ask for your opinion.

Thanks

By the way. Do you think that the a approach I used in case 2, for represent the webservice integration, is appropriated?

Thanks a lot.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wouldn't use a DAO for accessing JMS or a web service. Maybe another pattern though. Facade/adapter?
 
Ranch Hand
Posts: 46
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the key here is the separation of concerns. Your service layer should only do business logic, it should not worry about issuing HTTP calls to the webservice. If you inject your @WebserviceClient into your service layer, that seems like a nice separation of concerns. DAO are supposed to provide abstraction to a persistent store. Normally this store is your database, but you could also access a BigData store using a webserice, and still call it a DAO.

I would say that names are not critical, but the intention of the classes is. You could move them to an "integration" package. You could rename them as Facade/Adapter like Jeanne suggested. Just make sure that the single responsibility of the class is evident, and that you separate your business logic from your data access/integration logic.

Andres
 
Antonio Rafael Rodrigues
Ranch Hand
Posts: 75
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeanne and Thanks Andres.

I think Andres got my point of view. If I'm already injecting with @WebServiceRef in service layer (my business ejb) I already have a proper separation of concerns, then I don't need a DAO or Façade, all the http stuff will be done by the generated @WebServiceCilent. I'll place the webservice client in a integration package and this is it.

Thanks again =]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic