Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to fetch all rows from oracle view

 
Pankaj Jha
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gurus,
I wanted to fetch all rows from oracle view using entity bean(CMP. please explain me how to do it with some example code.
thanks in advance

pankaj
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CMP? Finding all rows is easy. All you'd have to do is define a method like "public Collection findAll() throws FinderException, RemoteException" in your home interface, and tell the container how to implement this finder when deploying the bean. Since the last step is container-specific, I can't tell you anything more about that. But any container should be able to implement a finder returning all rows.
You would not implement any bean creation methods.
The difficult bit might be that your view may not be updateable, so you'll have to convince your EJB container that it should not try to store the bean. Many containers offer facilities to avoid unnecessary stores by letting you either implement an isModified()-type callback on your bean, or indicate which methods don't modify the bean state.
If the number of records is large, performance is unlikely to be very good though. Finder methods just love to get lists of primary keys first, then fire a separate select statement at the database for every single record . You might want to consider a simple JDBC query in a session bean which simply returns a Collection of value objects.
- Peter

[This message has been edited by Peter den Haan (edited May 19, 2001).]
 
Pankaj Jha
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,
thanks for your reply
but one problem still i am facing is that, i am using visual age for java, websphere for development purpose, when i am trying to declare any finder method with return type Collection it shows me error but when i declare finder method's return type of Remote
interface type then it does not can you help me out.....
thanks
pankaj
 
Jayakumar Gopalan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pankaj,
it seems you have not imported java.util.Collection. try importing it and compile then.
 
Pankaj Jha
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i tried importing that also but it does not allows , but i got the solution that it allows Enumeration.
thanks
pankaj
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pankaj Jha:
Hi
i tried importing that also but it does not allows , but i got the solution that it allows Enumeration.
thanks
pankaj

I think you must be using IBM JDK 1.1.7/1.1.8 version.Both of them donot support the Java 2 Collection API.
-Sandeep
 
Pankaj Jha
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using visual age for java 3.5, what i think it supports java 2 api
thanks

pankaj
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic