• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

EJB usage

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am designing a web application and am in 2 minds wrt the middle tier technology.
I have 2 options:
1. Use EJB with session beans
2. Use Spring with POJOs

I am not able to think of scenario where having EJBs would be the correct choice. My web application would be multi-clusered app and has to handle pretty heavy transaction volumes.

I see EJB would be way to go if i want to have my middle tier located on a different machine than the presentation tier. I do not see a strong scenario where I would like to have that deployment architecture.

I looked into multiple applications which are using EJBs and found that the presentation tier and middle tier reside on the same JVM.

I want to take correct decision and thus would like to know from the experienced people here the reasons for using EJB
 
Ranch Hand
Posts: 623
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use EJBs in the same JVM as presentation layer, but you can also spread it across different JVM's. It's just one of the architectural decisions you have to make.

1. Use EJB with session beans
2. Use Spring with POJOs



Note that with EJB 3.x session beans are also POJOs.

Cheers!
 
Pankaj Kumarkk
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You can use EJBs in the same JVM as presentation layer, but you can also spread it across different JVM's. It's just one of the architectural decisions you have to make.


Yes I can do that. My question is "Why I would like to have such deployment architecture". I do not see any benefits due to such deployment structure. Please comment.

Note that with EJB 3.x session beans are also POJOs.


Thanks for the information.

Also my original question is still unanswered. Why I should go for EJB solution? Is it a viable solution in any scenario. (I do not think deploying business logic(thru EJBs) on a separate machine buys me any benefits)
 
Piotr Nowicki
Ranch Hand
Posts: 623
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pankaj Kumarkk wrote:

Pedro Kowalski wrote:You can use EJBs in the same JVM as presentation layer, but you can also spread it across different JVM's. It's just one of the architectural decisions you have to make.

Yes I can do that. My question is "Why I would like to have such deployment architecture". I do not see any benefits due to such deployment structure. Please comment.



Uhm, I'm a bit confused what would you like to know. What are the benefits of business and presentation living on the same tier or what are the benefits of business and presentation living in separate tiers?

I do not think deploying business logic(thru EJBs) on a separate machine buys me any benefits)


Well, I think you answered yourself :-) If your architecture doesn't need to use any remote objects and it's not spread across multiple JVM's (i.e. for clustering purposes) than there is no need to spread business logic layer and presentation layer across different tiers. Both layers can reside in one tier and use only local access.

Sometimes you need to serve remote clients (i.e. fat client, legacy software, etc.). In this case your presentation layer and business logic are on separate tiers. Then you'll need remote interfaces.

At the end - just remember that if you use EJB it doesn't mean that you need to separate layers between tiers. Just like using Spring doesn't mean that all layers resides on the same tier. You can use both approaches on either EJB or Spring.

Hope that helps.

Cheers!
 
Pankaj Kumarkk
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Well, I think you answered yourself :-) If your architecture doesn't need to use any remote objects and it's not spread across multiple JVM's (i.e. for clustering purposes) than there is no need to spread business logic layer and presentation layer across different tiers. Both layers can reside in one tier and use only local access.


Well I am not constrained by external applications. I need to decide on the architecture(EJB or Spring) based on which technology suits better. That's what I need advice on.
So do you think there is any advantage of using EJBs in a application.
If the advantages are significant enough then I would want to design my architecture to use EJBs.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, if you are designing a software application that contains business logic, there should be minimal code-level dependencies between the business logic and "any" commercial or open-source framework.

Using Spring Framework or Session EJB is a trivial decision. The business object model should easily work with both, and should not be dependent upon either API. In other words, the Business tier could be designed using EJB Framework and then switched over to Spring implementation in a matter of minutes (when using an independent business object model.)
 
I was her plaything! And so was this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic