
Click
here for enlarged picture
Using JX
generated code example
Accessing a
stateful EJB returning a Data Transfer
Object
The code extract below shows the invocation of a stateful
session bean (EJB) method (Sell) returning a Data Transfer
Object (DTO) -TradeResult.
FTrader represents an instance of a stateful session bean
obtained after invoking the appropriate method on the EJB
Home.
FTrader.Sell invokes the sell method on the stateful session
bean and returns a Data Transfer Object containing the
information of the trade (TradeResult).
The content of the TradeResult object (DTO) is displayed into
a Delphi GUI control.
This example is an extract of a JX demo showing how to access
a stateful session bean (EJB) hosted in BEA WebLogic 9.1
(Java SE 5.0).
...
{ Using JX EJB generated code }
FTrader:
Texamples_ejb_ejb20_basic_statefulSession_Trader;
...
procedure
TForm1.SellActionExecute(Sender:
TObject);
var
ATradeResult:
Texamples_ejb_ejb20_basic_statefulSession_TradeResult;
begin
...
{ Invoke EJB Sell method }
ATradeResult :=
FTrader.Sell('JX
demo user',
StockSymbolComboBox.Text, StrToInt(AmountEdit.Text));
try
{ Displays EJB returned DTO content }
RichEdit1.Lines.Add(ATradeResult.ToString);
finally
ATradeResult.Free;
end;
...
end;
Request a free trial download of JX for Delphi
Win32