Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Returning ResultSet from an EJB

 
Prakash Saswadkar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oreilly EJB by RMH talks about returning ResultSet from an EJB to the client.(Page 458-Oreilly)
My question - Is it possible to return a ResultSet from a remote method to the client? To use this resultset won't the client require the open connection that is associated with this resultset. Just serializing the resultset and sending it to the client will this maintain also the open connection?
If the above thing is possible will the client require the JDBC driver to access this resultset that is returned by remote method?
 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prakash Saswadkar:
Oreilly EJB by RMH talks about returning ResultSet from an EJB to the client.(Page 458-Oreilly)
To use this resultset won't the client require the open connection that is associated with this resultset.

To get a resultset there needs to be a connection but I don't believe that a resultset has an association with a connection after it is returned. A resultset is just another object.
Hope this helps,
 
Jacky Chow
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
It is not allowed, the ResultSet is not serialiable, so return a ResultSet to remote client breaks the rules for a RMI-IIOP !
 
Ken Boyd
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Copy your resultset to Collection & they are serializable. Also make sure you have serializable objects or premitives in Collection otherwise you will get runtime error.
Hope this help.
SCJP 1.4
SCWCD
 
Vivek Viswanathan
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This article has something about disconnected result sets
http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow.html

hope it helps
vivek
 
Nick Bauman
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a really bad idea, as it breaks MVC and "Seperation of Concerns" principle. Not to mention breaking the Law of Demeter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic