p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

enterprise_java_beans thread: Re: How to return ResultSet type valu e from EJB to Servlet?


Message #1 by "toxin" <toxin@b...> on Fri, 12 Jul 2002 09:28:02
> This message is in MIME format. Since your mail reader does not 
understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C21067.9482A120
Content-Type: text/plain

Yes Craig 
I agree with you completely!
If we want to use Resultset then might as well make direct JDBC calls. Why
use EJB???
and if we are using EJB then use Beans why use ResultSet?




> -----Original Message-----
> From:	craigb@w... [SMTP:craigb@w...]
> Sent:	Monday, June 10, 2002 4:53 PM
> To:	Enterprise Java Beans
> Subject:	[enterprise_java_beans] Re: How to return ResultSet type
> value from EJB to Servlet?
> 
> You just need to create a simply class that implements Serializable and
> within it create a member variable for storing the ResultSet, e.g.
> 
> import java.sql.ResultSet;
> import java.io.Serializable;
> 
> public class ReturnResultSet implements Serializable {
> 
>   private ResultSet rs;
> 
>   public ResultSet getResultSet() {      return rs;
>   }
>   public void setResultSet(ResultSet newRS) {
>      set rs = newRS;
>   }
> }
> However, I would question your architecture of wanting to pass a 
resultset
> from an EJB to a servlet. Why are you using an EJB? Why do you need the
> entire resultset?
> 
> Cheers
> 
> Craig
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or 
> to unsubscribe send a blank email to
> 

------_=_NextPart_001_01C21067.9482A120
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [enterprise_java_beans] Re: How to return ResultSet type =
value from EJB to Servlet?</TITLE>
</HEAD>
<BODY>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Yes Craig </FONT>
<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">I agree with you =
completely!</FONT>
<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">If we want to use =
Resultset then might as well make direct JDBC calls. Why use =
EJB???</FONT>
<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">and if we are using =
EJB then use Beans why use ResultSet?</FONT>
</P>
<BR>
<BR>
<BR>
<UL>
<P><FONT SIZE=3D1 FACE=3D"Arial">-----Original Message-----</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"Arial">From:&nbsp;&nbsp;</FONT></B> <FONT =
SIZE=3D1 FACE=3D"Arial">craigb@w... [SMTP:craigb@w...]</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"Arial">Sent:&nbsp;&nbsp;</FONT></B> <FONT =
SIZE=3D1 FACE=3D"Arial">Monday, June 10, 2002 4:53 PM</FONT>
<BR><B><FONT SIZE=3D1 =
FACE=3D"Arial">To:&nbsp;&nbsp;&nbsp;&nbsp;</FONT></B> <FONT SIZE=3D1 =
FACE=3D"Arial">Enterprise Java Beans</FONT>
<BR><B><FONT SIZE=3D1 =
FACE=3D"Arial">Subject:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT>=
</B> <FONT SIZE=3D1 FACE=3D"Arial">[enterprise_java_beans] Re: How to =
return ResultSet type value from EJB to Servlet?</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">You just need to create a simply class =
that implements Serializable and</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">within it create a member variable =
for storing the ResultSet, e.g.</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">import java.sql.ResultSet;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">import java.io.Serializable;</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">public class ReturnResultSet =
implements Serializable {</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; private ResultSet rs;</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; public ResultSet getResultSet() =
{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return rs;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; }</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; public void =
setResultSet(ResultSet newRS) {</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp; set rs =3D =
newRS;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; }</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">}</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">However, I would question your =
architecture of wanting to pass a resultset</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">from an EJB to a servlet. Why are you =
using an EJB? Why do you need the</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">entire resultset?</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Cheers</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Craig</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">---</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Change your mail options at <A =
HREF=3D"http://p2p.wrox.com/manager.asp" =
TARGET=3D"_blank">http://p2p.wrox.com/manager.asp</A> or </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">to unsubscribe send a blank email to =
</FONT>
</P>
</UL>
</BODY>
</HTML>
------_=_NextPart_001_01C21067.9482A120--


good!

  Return to Index