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.
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?
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.
I'll try and ask Crystal directly, in the meantime hope the above helps.
Looking forward to hearing from you...
NB Great book Kyle :-)
Joined: Aug 10, 2001
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...
Joined: Jul 12, 2004
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.
Joined: Aug 10, 2001
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.