The moose likes EJB and Other Java EE Technologies and the fly likes StringBuffer as an EJB parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "StringBuffer as an EJB parameter" Watch "StringBuffer as an EJB parameter" New topic
Author

StringBuffer as an EJB parameter

Ewandro Araujo
Greenhorn

Joined: Nov 01, 2001
Posts: 4
I created an EJB using a StringBuffer parameter.
When I debug my app (using JBuilder and Weblogic 6.1) I can see my StringBuffer contents at the EJB/Server side but my StringBuffer variable at client side (when the method returns) has nothing inside.
Thanks for any help
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3878
Can you show us the client code? One thing to remember is that EJBs work in a pass-by-value way, not pass by reference. So, something like this client code:
StringBuffer foo = new StringBuffer();
myEJB.doSomethingWith(foo);
won't affect the value of foo at all -- that's because what is sent to the EJB is a copy of foo (due to the serialization and deserialization of the parameters).
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Ewandro Araujo
Greenhorn

Joined: Nov 01, 2001
Posts: 4
Thanks a lot.
Was exctly this problem...pass-by-value way.
Cheers
Ewandro
 
 
subject: StringBuffer as an EJB parameter
 
Threads others viewed
StringBuffer and general performance questions
StringIndexOut OfBoundsException
Urgent - Some Exception Error that I receive
StringBuffer capacity
Performance between Array list and StringBuffer to store Large amount of data?
MyEclipse, The Clear Choice