aspose file tools*
The moose likes Websphere and the fly likes Question for Kyle or WAS Expert : Help with creating EJB ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Question for Kyle or WAS Expert : Help with creating EJB ResultSet " Watch "Question for Kyle or WAS Expert : Help with creating EJB ResultSet " New topic
Author

Question for Kyle or WAS Expert : Help with creating EJB ResultSet

M Aslam
Greenhorn

Joined: Jul 12, 2004
Posts: 14
Hi,

Kyle, I'm new to WAS/WASD and have been looking through your book I purchase recently. I don't know if my approach is correct but I need
to return an EJB result set from WAS to an external service run by Crystal Enterprise which expects an EJB data source.

I need to create an EJB in IBM Websphere which returns a resultset
(from database query), I assume it will be session bean that is invoked by the external service which then kicks of an entity bean for getting the result set.

Could yo point me to some code that that accepts some parameters for
producing the result set, then does the work (can any be any query) and returns the result set.

Any pointers would be very much appreciated.

Thanks!
[ July 14, 2004: Message edited by: Azeem Sattar ]
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
I do not believe a result set is serializable. Therefore, you would have problems returning it from an EJB. In my opinion, best practice may be to create a javabean that is Serializable. For each result returned from the query, populate an instance of this bean and put the bean in a List. Return the List of beans instead of a ResultSet.


No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Bill is right. You can't return a ResultSet from an EJB. Can you point us at some online documentation on Crystal that indicates what they're really looking for? That might give us more of an indication of what to go on.

Kyle


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.
M Aslam
Greenhorn

Joined: Jul 12, 2004
Posts: 14
Kyle/Bill,

Thanks very much for your response. I can't seem to find any concrete examples on the web. However , here is a URL to Cystal's paper on this issue, please esee page 2

http://support.businessobjects.com/communityCS/TechnicalPapers/cr9_java.pdf
'Connectivity to Custom Java Data Sources'.

I'll try and ask Crystal directly, in the meantime hope the above helps.

Looking forward to hearing from you...

NB Great book Kyle :-)
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Thanks Azeem! Well, I agree that Crystal doesn't give you much to go on. I'm not sure how they intend to make this work as an EJB -- my only guess is that the EJB and the POJO interfaces are very different...

Kyle
M Aslam
Greenhorn

Joined: Jul 12, 2004
Posts: 14
I'm told that the serialize problem is overcome by the use of a
RowSet class that serves mainly as a thin wrapper around a ResultSet object to make a JDBC driver look like a JavaBeans.

The rowset I'm told is serializable, cached rowsets can be created and transferred across the wire since it is serializable and cloneable. For example, my EJB component can create and return a cached rowset to a client across the network.

Am I on the right track now? so it looks like I now need to know now an EJB
can create and return a cached rowset.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Well, if they're just creating Javabeans that happen to implement the java.sql interfaces, it would work, but this seems like it would be dependent on their own classes.

Kyle
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question for Kyle or WAS Expert : Help with creating EJB ResultSet