File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Passing object from Web tier to Ejb tier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Passing object from Web tier to Ejb tier" Watch "Passing object from Web tier to Ejb tier" New topic
Author

Passing object from Web tier to Ejb tier

Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
If I want to pass an object from the web tier to the ejb tier, do we use a VO or a domain object? I know the "norm" of passing VO from ejb tier to the web tier but what is the best practice when it comes to web to ejb tier?
I have certain business service interfaces (pricing strategies etc) which would act upon these objects and I find it a little odd that the interface method would have a VO as its method signature instead of a domain object.

Parag
H. Hafer
Ranch Hand

Joined: Aug 23, 2004
Posts: 108
Parag,

since the web tier shouldn't know too much about the internals of the ejb tier and there're several patterns to achieve that (e.g., BD, Facade) my guess would be VO using an update strategy if that's necessary.

HTH,
Harbo
Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
Originally posted by H. Hafer:
Parag,

since the web tier shouldn't know too much about the internals of the ejb tier and there're several patterns to achieve that (e.g., BD, Facade) my guess would be VO using an update strategy if that's necessary.

HTH,
Harbo


Harbo,
Yeah, the VO update strategy works where updates are needed to be sent across to the ejb tier. Thats not a problem.
My problem can be best illustrated with an example : I have a service interface which prices a Product and I want to pass the Product which it should price,my problem is that the Product is passed as a ProductVO from tier to tier and as a result of which, my interface method is now getPrice(ProductVO) instead of getPrice(Product), which doesnt look nice as anyone requiring that service would have to create a ProductVO first and then access this service, which seems rather restricting.

what is the way out of this VO-ness?

Parag
H. Hafer
Ranch Hand

Joined: Aug 23, 2004
Posts: 108
Parag,

probably I didn't fully understand your example, but I can't imagine anyone to use getPrice(Product) outside the business logic. The clients shouldn't be aware of these internals. On the other hand, the business logic designer had a good reason to implement ProductVOs, because VOs are, well, valuable :-)
So there's no point in using getPrice(Product) on the business tier either.

As a side note, I sincerely hope that details of this depth are not required for the assignment -- else we'll witness the falling of Hafer someday ;-)

HTH,
Harbo
Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
Originally posted by H. Hafer:
Parag,

probably I didn't fully understand your example, but I can't imagine anyone to use getPrice(Product) outside the business logic. The clients shouldn't be aware of these internals. On the other hand, the business logic designer had a good reason to implement ProductVOs, because VOs are, well, valuable :-)
So there's no point in using getPrice(Product) on the business tier either.

As a side note, I sincerely hope that details of this depth are not required for the assignment -- else we'll witness the falling of Hafer someday ;-)

HTH,
Harbo


Harbo,
I have a scenario where a stateless session bean calculates price. It looked odd that the business method would take a VO as a parameter instead of a domain model object. Maybe, it seems odd to me..but is it alrite to have a VO passed as a parameter to a stateless session bean method? All this is executing in the business tier. The stateless session bean could be called by a session facade.


Parag
 
Consider Paul's rocket mass heater.
 
subject: Passing object from Web tier to Ejb tier