Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Suggestion Required on packaging POJOs/DTOs with Web Service projects

 
Venkataprasath Padmanabhan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Developing JAX-WS Webservices using Top down approach. the wsdl is defined with xsds, generating java code using IBM RAD tool creates package structure and all Request and Response java classes in Web Service Project. Most of these java objects represent the actual domain objects which will be used by DAO layer.

If we package DAO layer and business services in a separate project/jar, the Domain objects have to reside in this project.

Can anyone suggest the best option of handling this. Should we have all DAO layer within Web Service project so that DAO uses the classes generated using WSDL or move these classes to DAO project which requires a manual step whenever wsdl is changed?

Thanks,
Venkat
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
The classical answer is: It depends.
It depends on whether you expect changes to the web service or not, whether you expect changes to the system or not.
If you want to decouple the web service from the domain classes, then you should not let generated code leak down to the DAO layer. In fact, I would suggest having a look at the hexagonal architecture - develop the application without UI, database etc etc and, when the application itself is ready, add different kinds of adapters, in your case a database adapter and a web service adapter, as needed.
If you are in a hurry, do not expect changes in the web service or in the application etc etc, then you can generate code and use it in the DAO layer too.
Best wishes!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic