Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing object from Web tier to Ejb tier

 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic