• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

how to fetch all rows from oracle view

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
eat bricks! HA! And here's another one! And a tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic