• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 3.0: SLSB with two methods a() and b(). Is it bad practise calling b() from a()?

 
Kenneth Gustafsson
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If I have a stateless session bean with two methods. And I call one from the other. Is that bad practise? It's what I hear, but I would like to know why.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kent,
It's not bad practice. Did the people who said it was give any reasons?
 
Kenneth Gustafsson
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it was something a teacher told my collegue when he attended a Java EE 5 course. I got curious as to why (as the teacher didn't say) and thought I would ask you folks as most of you are more experienced with JEE than me.

So if anyone can give a reason as to why, or why not, you certainly have my attention.
[ May 26, 2008: Message edited by: Kent Larsson ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a reason for why not: Session bean methods are just methods. The outer one gives you the lifecycle management support (transactions, security, etc). After that, you are just calling Java methods.

This is common when signatures are deprecated. If I have method(int) and want to change it to method(int, int), I may want to stay backward compatible for a while and have the later call method(int, 0). Just like in regular Java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic