aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB 3.0: SLSB with two methods a() and b(). Is it bad practise calling b() from a()? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB 3.0: SLSB with two methods a() and b(). Is it bad practise calling b() from a()?" Watch "EJB 3.0: SLSB with two methods a() and b(). Is it bad practise calling b() from a()?" New topic
Author

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

Kenneth Gustafsson
Ranch Hand

Joined: Jan 10, 2008
Posts: 40
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
135

Kent,
It's not bad practice. Did the people who said it was give any reasons?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Kenneth Gustafsson
Ranch Hand

Joined: Jan 10, 2008
Posts: 40
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
135

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB 3.0: SLSB with two methods a() and b(). Is it bad practise calling b() from a()?
 
Similar Threads
finally clause
Regarding import statements
Is this a bug in Eclipse's compiler?
WARNING: Whizlabs Practise exam format has changed
Deprecation of Methods