Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Facade or POJO Facade that is the question.

 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers.

I am have an 'exciting' debate with a 'friend' over the facade pattern. Bascially the issue is about how to implement the facade interface. Is it better to use a Session Bean or a POJO? What are the advantages/dis-advantages of both?

Thanks.
 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...answering my own question.

http://www.coderanch.com/t/312740/EJB-JEE/java/session-facade-pattern-call-entity

Further comments welcome...
 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...1 final point...the debate assumess that NO entity beans will be used.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They do totally different things! A Session facade gives distribution and transaction management -- a POJO facade doesn't. You might as well compare apples and oranges...

Kyle
 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know. I think I may have confuse you with the question. Bascially it was circled around Web Services and whether to use a normal facade or a session facade as the 'end point' if no Entity Beans are going to be used to persist the data.

--

It seems the best design after doing some digging is to use a POJO as the web service end point which then uses a Session Facade.

I can see how my post was a complete load of rubbish.

Thanks anyway.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't heard of a POJO as the web service, but containers do vary a lot.

We use WebLogic whose web services are packaged as standard J2EE Enterprise applications that consist of the following specific components:
A Web application that contains a servlet that sends and receives SOAP messages to and from the client.

A stateless session bean that implements a synchronous RPC-style Web service or a JMS listener for an asynchronous message-style Web service.
In an RPC-style Web service, the stateless session bean (which appears as a remote object to the client) receives the client request and can invoke the appropriate method of a session facade.

In a message-style Web service, a MessageListener object (typically a message-driven bean) gets the messages from the JMS destination and processes them.
 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oracle9iAS (OC4J) allows you to have 4 options. The intercepting servlet to handle requests is configured via the container.

Stateless Pure Java Web Service
Stateful Pure Java Web Service
Stateless PL/SQL Web Service
Stateless Session EJB Web Service

See: http://otn.oracle.com/tech/java/oc4j/htdocs/how-to-ws-simple.html

James
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by James Clinton:
I know. I think I may have confuse you with the question. Bascially it was circled around Web Services and whether to use a normal facade or a session facade as the 'end point' if no Entity Beans are going to be used to persist the data.

--

It seems the best design after doing some digging is to use a POJO as the web service end point which then uses a Session Facade.

I can see how my post was a complete load of rubbish.

Thanks anyway.


Now I see the point. Yes, in this case, where there is *no* transactional management you might use a POJO. But let me point out the advantages of a Session facade:

(1) You get 2-PC transactional management if you need it -- can't add it to a POJO easily, but it's as easy as changing the DD on a Session bean.

(2) You get the ability to choose between RMI/IIOP and Web Services. There are some significant performance reasons why you may choose RMI/IIOP for some clients of the same service.

Hope this helps.

Kyle
 
It will give me the powers of the gods. Not bad for a tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!