wood burning stoves 2.0*
The moose likes Other Application Frameworks and the fly likes Advantage of using Spring Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Advantage of using Spring Framework" Watch "Advantage of using Spring Framework" New topic
Author

Advantage of using Spring Framework

Puneeth Shankara
Greenhorn

Joined: Aug 29, 2008
Posts: 3
hello everybody,

I am new to spring framework. Can anybody tell me what is the advantage of using Spring framework.
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Check this.

Cheers,
Raj.
aditee sharma
Ranch Hand

Joined: Jul 22, 2008
Posts: 182
Ok, I have one question about this comparison thats not answered by the suggested link.Or may be I wasn't smart enough to figure it out.
In a traditional session facade architecture, I used EJB 2.0 (Session Beans) that can participate in a distributed transaction.
This is obvious because EJB 2.0 have a remote interface so one can make call across the network.

I read this article that says POJO facade is no good for distributed transaction.
My question : If we use spring, will it allow a POJO facade to support distributed transaction ? If not, then isn't that a disadvantage of using spring over EJB?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by aditee sharma:
If not, then isn't that a disadvantage of using spring over EJB?


I don't know if Spring does this or not. But if it doesn't then yes, I would say that is a disadvantage if your requirement is distributed transaction. Otherwise, the point is moot. What exactly is your requirement?


GenRocket - Experts at Building Test Data
aditee sharma
Ranch Hand

Joined: Jul 22, 2008
Posts: 182

What exactly is your requirement?

No requirement as such. I am just trying to understand and increase my knowledge.
Can we use Spring with POJO's for distributed transactions or not?
In particular, I want to know that is it really that a POJO facade can never be used in a distributed transaction, or can we do it with Spring or any other framework.

One more point: A transaction may not be distributed even though the environment is distributed. Correct?
So, is Spring good for a distributed environment? (eg. for failover).
Have a nice long weekend!.
aditee sharma
Ranch Hand

Joined: Jul 22, 2008
Posts: 182
To help you understand my question better:
I have a mostly EJB 2.0 background.
I do know a little about Spring but certainly not the finer aspects like how it handles distributed transactions etc.
Hope that helps.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

The thing with Spring is that you create Pojos you don't have to create any classes or such that have to be set up for transactions. In the SPring Framework you can just create a bean called "transactionManager" and have any Transaction Manger implementation that you want. So if you want distributed transactions, then make it a JtaTransactionManager, but you will need to include that implementation's jar, but that is the same for any Java app that you want to use a class that is in some jar, you have to include that jar in the classpath.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
aditee sharma
Ranch Hand

Joined: Jul 22, 2008
Posts: 182
Thanks Mark.What you said is a more detailed explanation of my vague knowledge about spring transaction mechanism.
However, I am still not able to understand the assertion in this article that POJO facade is not good for distributed transactions and that a EJB session facade is better.
If you can please spend some time going over this article, you'll find that the author does mention "Spring" in a POJO facade approach, and still finds it incapable of handling a distributed transaction.

You may wonder why I don't ask this question in the same web site that is being referred, but I couldn't find a way to pose a question to the author there.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Originally posted by aditee sharma:
Thanks Mark.What you said is a more detailed explanation of my vague knowledge about spring transaction mechanism.
However, I am still not able to understand the assertion in this article that POJO facade is not good for distributed transactions and that a EJB session facade is better.
If you can please spend some time going over this article, you'll find that the author does mention "Spring" in a POJO facade approach, and still finds it incapable of handling a distributed transaction.

You may wonder why I don't ask this question in the same web site that is being referred, but I couldn't find a way to pose a question to the author there.


That article is over 2 1/2 years ago. Technology has changed way too much. So I wouldn't take what is said about distributed transactions as true today. It might still be, but I wouldn't want you to get confused. Oops.

Mark
aditee sharma
Ranch Hand

Joined: Jul 22, 2008
Posts: 182
I see, thanks. So that's why I din hear anything from the recruiter the other day, after that interview
Wirianto Djunaidi
Ranch Hand

Joined: Mar 20, 2001
Posts: 210

After reading at the article that you linked, it was a bit of misleading because the author is implicitly comparing Remote Session Bean against the POJO.

Basically any POJO facade that you implement with Spring is comparable to Local Session Bean, which based on the author assertion also can not be part of distributed transaction when called by remote client...because they can't be called remotely.

So the limitation of POJO facade is not the POJO itself, but totally depend on the remoting strategy that you choose. With EJB your only option is Remote EJB. With POJO facade you can choose many options of remoting that is supported by Spring, if those remoting option can support distributed transaction .. then your POJO facade can be part of the distributed transaction.
aditee sharma
Ranch Hand

Joined: Jul 22, 2008
Posts: 182

With POJO facade you can choose many options of remoting that is supported by Spring


Thanks Wirianto for such a direct answer.
So, how do we specify a remoting strategy when using a POJO facade with Spring? Is it through the transaction manager or something else?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Originally posted by aditee sharma:


Thanks Wirianto for such a direct answer.
So, how do we specify a remoting strategy when using a POJO facade with Spring? Is it through the transaction manager or something else?


Actually it is as simple as declaring a bean in which the class is the remoting technology that you want to use Exporter class. Spring uses and Exporter class to expose your POJO in that remoting technology. So for RMI, RMI-IIOP, or their HttpInvoker.

And on the client side there are Factories that can create a proxy that implements your POJOs interface and handle the remote calling, and also making Exception handling easier with unchecked exceptions.

For instance with RMI, you don't have to catch RemoteExceptions, your interface doesn't have to extend Remote interface, etc.

Mark
aditee sharma
Ranch Hand

Joined: Jul 22, 2008
Posts: 182
thanks Mark, that was very informative.
From this point, it should be easier to google and learn the intricacies of distributed transaction in Spring.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Advantage of using Spring Framework
 
Similar Threads
Eclipse error : Declared package does not match expected package
struts2 Vs spring mvc
How many folks use Spring?
Struts Vs Spring
Advantage of Spring than EJB