PDA

View Full Version : Swing + SLSB + Hibernate



gegas
Apr 28th, 2005, 08:20 AM
Hello!

I'm trying to design an application that should admit to be run as both a 2-tier and 3-tier.
The client is a Swing application in both scenarios.

On the 2-tier design the Swing application will use a pojoFacadeApplicationContext.xml configuration with only POJO's. All code is executed on a single JVM. No EJB's is used. Since there is only one Spring IoC instance we can refer to other context configuration files etc. Everything executes on one single machine.

On the 3-tier approach the client will use another ejbFacadeAppplicationContext.xml configuration looking up SLSB using Spring's SimpleRemoteStatelessSessionProxyFactoryBean. NOTE! There is a Spring IoC on the client-side. This (client) context configuration file cannot refer to a configuration file telling Spring how to wire the business objects , DAO's etc. since it's one a different machine (and all the business object class files is also on another machine - the app. server).

I'd like to use a businessApplicationContext.xml in the app. server that wires the correct DAO with the correct business object which is deployed as an SLSB on the server side. There is no need for the client to know about this. Is this possible? How is this business context configuration file loaded and read by a Spring IoC on the server-side?

All examples I've seen run a single instance of a Spring IoC using the web, but I like to run one at the client-side (switching context configuration files decides if we access local POJO's or remote SLSB) and one at the server-side (wiring up the business objects and DAO's).

Regards, Andreas Eriksson

Rod Johnson
Apr 28th, 2005, 08:27 AM
Andreas

Yes, if you use the EJB Business Methods pattern, it's possible to simply reconfigure to switch between SLSBs and local POJOs, without changing code. I have seen clients use this approach successfully.

You just need to be careful that the signatures on that interface support both call-by-value and call-by-reference: for example, that all your arguments and return types are serializable.

Rgds

gegas
Apr 28th, 2005, 08:32 AM
Thanks for a quick respons!

Ok, so when the SLSB is instantiated on the app. server (due to my Swing clients invocation) it will read the Spring IoC servicer-side configuration file automagically?

Who (on the server-side) is creating the ApplicationContext?

Regards, Andreas

gegas
Apr 28th, 2005, 08:50 AM
Ok, I think I got it after reading this:

http://www.springframework.org/docs/reference/ejb.html

Regards, Andreas

myace
Jun 11th, 2005, 08:01 AM
I have a same app.
three Adaper :
a EJB2 Remote Accessing Adaper
a EJB3 Remote Accessing Adaper
and a Local Accessing Adaper (for test or for 2 lay) .