Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB or not ?

 
Benoît de Chateauvieux
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I'm working on my part 2 and I need to design a component that allows the integration with an external JMS system.
My component
- is not transactional.
- doesn’t need to be remotely invoked.
- is a lightweight component and its construction isn’t costly.

I'm planning to design it as a POJO.
It's less "modular" and less "service oriented" but I don't think I need an EJB.

What's your opinion ?
Do you think it can impact the scalability or other system quality ?

Thanks a lot for your responses,

Benoît
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like a POJO to me!

Which version of the exam is this? JEE, right?

Yeah, it sounds like a POJO.

-Cameron McKenzie

 
Benoît de Chateauvieux
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answer, Cameron !
Yes, it is SCEA 5.0 for Java EE.

For you, what would be the advantages of designing it as an EJB ?
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, what is an EJB in JEE5?

This clearly isn't a persistent object, so no JPA is in use.

So, it really must be designed as a POJO. From there, we can provide a Java Enterprise Edition 5 annotation on the bean so it can take advantage of some EJB container services. Which ones might this bean benefit from? Perhaps multi-threaded control? Perhaps the ability to apply security attributes to certain methods? Does this bean need to control any transactional attributes of JPA beans that it invokes? If so, perhaps using an annotation to characterize it as a session bean, and then slapping some declarative transactional attributes on it might be helpful.

There's always huge benefits to using an EJB. But, at the same time, one of the biggest downfalls of J2EE development over the past five years has been the overdesign of components. Too many people have overdesigned components into EJBs, causing huge problems.

But the SCEA exam isn't a place to be asserting any personal beliefs about application design. It's a place to be demonstrating that you know how to use JEE5 components. Sometimes it's not as important to design these things according to what you think might be the best approach in your day-to-day job, but instead, according to what you think the examiners want to see in your final project.

Is that a wishy-washy enough answer for you?

-Cameron McKenzie

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic